scribase
Performanceversion 0.2.0

index_advisor

Suggest the indexes that would speed up a query.

What it is for

index_advisor takes a query, tries candidate indexes with HypoPG, and returns the CREATE INDEX statements that lower its cost, with the cost before and after. Turning it on also turns on hypopg.

Enable it

sql
create extension if not exists hypopg with schema extensions;
create extension if not exists index_advisor with schema extensions;

Needs hypopg, which is turned on first.

Example

sql
select startup_cost_before, startup_cost_after,
       total_cost_before, total_cost_after,
       index_statements, errors
from index_advisor('select * from orders where customer_id = $1 and status = $2');

Questions

How do I enable index_advisor?

Run create extension if not exists hypopg with schema extensions; create extension if not exists index_advisor with schema extensions; in the SQL editor, or switch it on from the Extensions page in the console. You do not need superuser access.

Which version of index_advisor is installed?

0.2.0, on Postgres 17.6, as read from the running engine on 2026-10-08. Check yours with: select extversion from pg_extension where extname = 'index_advisor';

Upstream project: github.com/supabase/index_advisor

More performance extensions

  • pg_stat_statements Timing and call counts for every query shape (Insights reads it).
  • hypopg Try an index without building it, to see if the planner would use it.
  • pg_repack Remove table and index bloat without long locks.