Skip to content

Live Queries

The Live Queries page is the primary view in IndeX-Ray. It connects to your database through the analyzer, pulls in every query tracked by pg_stat_statements, and runs each one through an optimization analysis — surfacing index recommendations, cost reductions, and augmented explain plans.

The main view is a sortable table of all captured queries. Each row shows:

ColumnDescription
QueryCleaned SQL text (first two lines)
StatusOptimization state (see below)
CostEstimated cost reduction (baseline to optimized), if available
NudgesCount of suggestions grouped by severity (critical, warning, info)
First SeenWhen the query first appeared in pg_stat_statements
Mean TimeAverage execution time in milliseconds
CallsTotal execution count
% of RuntimeShare of total database runtime

Click any column header to sort. The default sort ranks queries by nudge severity so the most actionable queries surface first.

Queries sync from the database every 60 seconds automatically. Use the Refresh button to sync immediately.

The left sidebar provides filters to narrow the list:

  • Affecting Table — show only queries that touch a specific table
  • Only SELECT queries — hide writes (INSERT, UPDATE, DELETE)
  • Filter out system queries — hide queries against pg_* and information_schema
  • Filter out targetless queries — hide SELECTs without a FROM clause (e.g. SELECT 1)
  • Only improved queries — show only queries where optimization found a better plan
  • Status — multi-select to show/hide specific optimization states

All filter preferences persist in your browser across sessions.

Each query goes through an optimization pipeline. The status column reflects its current state:

StatusMeaning
WaitingQueued for analysis
OptimizingCurrently being analyzed
Improvements availableFound index recommendations with a cost reduction
No improvement foundQuery is already optimal given the current schema
Not supportedQuery type can’t be optimized (e.g. DDL, utility)
TimeoutAnalysis exceeded the time limit
ErrorAnalysis failed

The status bar at the bottom of the page shows overall progress: how many queries have been processed, how many have improvements, and how many are still waiting.

Clicking a query opens a detail view with four sections:

Top-left panel showing the query’s key metrics: status, cost, mean time, calls, runtime share, and first-seen date.

Top-right panel containing:

  • Nudges — optimization suggestions grouped by severity (critical, warning, info), with full explanations
  • Suggested indexes — concrete CREATE INDEX recommendations when improvements are available
  • Tables accessed — every table the query touches
  • Indexes used — indexes referenced in the current plan, linked to the Indexes page
  • TagsSQLCommenter metadata (source file, route, method) if present

Bottom-left panel with the SQL text, annotated inline with nudge markers showing exactly where in the query each suggestion applies.

Bottom-right panel with the query’s execution plan. When improvements are available, you can toggle between the Baseline plan (current schema) and the Optimized plan (with suggested indexes applied) to see the difference.

Three view modes are available:

Use the previous/next arrows (or keyboard arrows) in the detail header to navigate through your filtered query list without returning to the table.

  • Refresh — manually trigger a sync from the database
  • Export to JSON — download all queries with improvements as a JSON file
  • Reset queries — clear pg_stat_statements on the source database (see source code mapping for when this is useful)
  • Settings — configure your IDE preference for clickable file links