# index_advisor — Postgres extension

> Suggest the indexes that would speed up a query.

Source: https://scribase.com/extensions/index_advisor

Category: Performance. Version: 0.2.0. Optional, enabled per project.

## About

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;
```

## 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');
```

Requires: hypopg.

Upstream: https://github.com/supabase/index_advisor