Index advisor
pg_index_advisorSuggests indexes for missing foreign-key support and large-table sequential scans, and compares query planner costs for hypothetical CREATE INDEX commands without creating them.
Instructions
Suggest indexes. Without sql it lists foreign keys with no supporting index (which
make deletes and joins on the parent scan the child table) and large tables read almost
only by sequential scans, each with a ready CREATE INDEX suggestion where one is clear.
With sql and hypothetical_indexes (a list of CREATE INDEX commands) it compares the
planner's estimated cost of the query before and after the indexes, without creating
anything: it needs the hypopg extension.
table (name, schema.name or pattern) narrows the heuristics. The query is checked by
the same rules as pg_query and is never executed, only planned. Indexes speed up reads and
slow down writes: add only the ones a real query needs.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "pg_index_advisor"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | No | ||
| limit | No | ||
| table | No | ||
| connection | No | ||
| hypothetical_indexes | No |