Skip to content

Analyzer

The analyzer is an open-source Docker container that runs on your machine and acts as a bridge between your PostgreSQL database and the Query Doctor browser tooling. Because IndeX-Ray runs in the browser, it cannot connect to an external database directly — the analyzer handles that connection locally, so your data never leaves your machine.

Source code: github.com/query-doctor/analyzer

The analyzer makes read-only queries against your database to collect:

  • Schema — tables, columns, indexes, constraints, functions, views, types, triggers, and extensions.
  • Query statistics — recent queries and their execution metrics from the pg_stat_statements extension. Note that pg_stat_statements can contain real query text, including literal parameter values depending on your PostgreSQL configuration.
  • Table statistics — row estimates and sample rows from your tables, used for query plan analysis. These are real values read from your database.
Terminal window
docker run --pull always -t -p 2345:2345 ghcr.io/query-doctor/analyzer
Terminal window
git clone https://github.com/Query-Doctor/analyzer.git
cd analyzer
docker build -t analyzer .
docker run -p 2345:2345 analyzer

The analyzer listens on port 2345 by default.

  1. Start the analyzer.
  2. Open IndeX-Ray and begin the onboarding flow.
  3. The default endpoint is http://localhost:2345. If you’re running the analyzer on a different host or port, expand Advanced settings in the first onboarding step to change it.
  4. Enter your PostgreSQL connection string and sync.

IndeX-Ray checks the analyzer’s health endpoint (GET /health) every 10 seconds and shows a status indicator so you know the connection is live.

The analyzer exposes two endpoints:

Returns { "status": "ok" } when the analyzer is running and ready.

Syncs schema and query data from the source database.

Request body:

{
"db": "postgresql://user:password@host:5432/database"
}

Response: a RemoteSyncResponse containing:

FieldDescription
metaAnalyzer version and inferred statistics strategy
schemaFull database schema (tables, indexes, constraints, etc.)
queriesRecent queries from pg_stat_statements with metrics
disabledIndexesIndexes that are currently disabled

Each field is wrapped in { type: "ok", value: ... } or { type: "error", error: "..." } so partial failures (e.g. pg_stat_statements not installed) don’t block the rest of the sync.

  • pg_stat_statements extension — required for query statistics. Install it with:

    CREATE EXTENSION IF NOT EXISTS pg_stat_statements;

    The extension must also be added to shared_preload_libraries in your PostgreSQL config, which requires a server restart.

  • Read access — the database user in your connection string needs read access to the schema and statistics views. No write permissions are required.