Use EXPLAIN/ANALYZE, logging, and the auto_explain extension to trace and fix slow ParadeDB queries.
Start by timing the query with EXPLAIN ANALYZE
. The plan reveals sequential scans, missing indexes, or mis-estimated row counts that often cause slowness.
Prefix the statement with EXPLAIN (ANALYZE, BUFFERS, VERBOSE)
. ParadeDB executes the query, then prints the actual run time, rows processed, and I/O statistics.
Yes. Enable the auto_explain
extension and set auto_explain.log_min_duration
(ms). ParadeDB will log any query whose runtime exceeds that threshold, plus its execution plan.
Set log_statement = 'all'
or 'mod'
in postgresql.conf
or the current session. Combine with log_duration = on
to get timing for each statement.
Sequential scans on large tables, nested-loop joins with high row counts, and sorts spilling to disk (Sort Method: external merge
) usually signal missing indexes or bad work_mem settings.
Use CREATE INDEX CONCURRENTLY
to build the index online, run the query again, and then drop the index if it does not help. ParadeDB will choose the index automatically if beneficial.
Temporarily raise work_mem
, lower random_page_cost
on SSDs, and enable track_io_timing
. Always reset them after testing to avoid side effects in production.
Run tests in a staging clone, keep auto_explain
thresholds conservative, and store logged plans in a versioned repository so the team can compare past and present performance.
Yes, it executes the query, so wrap data-changing statements in a transaction and roll back.
You can run EXPLAIN/ANALYZE. Loading auto_explain
or changing server-wide logs requires superuser or admin privileges.
Redirect EXPLAIN output to a file in your SQL client or use \o plan.txt
in psql.