Skip to content

index_advisor

Query index advisor

index_advisor · Query index advisor

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
2800index_advisorindex_advisor0.2.1FEATPostgreSQLSQL
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
----d-rNoNoNoYesyesno
Package and SQL version 0.2.1; requires HypoPG; planner estimates only.

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY0.2.119 18 17 16 15index_advisorhypopg
RPMPIGSTY0.2.119 18 17 16 15index_advisor_$vhypopg_$v
DEBPIGSTY0.2.119 18 17 16 15postgresql-$v-index-advisorpostgresql-$v-hypopg
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1
el8.aarch64N/APIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1
el9.x86_64PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1
el9.aarch64PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1
el10.x86_64PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1
el10.aarch64PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1
d12.x86_64PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1
d12.aarch64PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1
d13.x86_64PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1
d13.aarch64PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1
u22.x86_64PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1
u22.aarch64PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1
u24.x86_64PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1
u24.aarch64PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1
u26.x86_64PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1
u26.aarch64PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1PIGSTY 0.2.1
PackageVersionOSORGSIZEFile URL
index_advisor_190.2.1el9.x86_64pigsty10.2 KiBindex_advisor_19-0.2.1-1PGSTY.el9.noarch.rpm
index_advisor_190.2.1el9.aarch64pigsty10.2 KiBindex_advisor_19-0.2.1-1PGSTY.el9.noarch.rpm
index_advisor_190.2.1el10.x86_64pigsty10.4 KiBindex_advisor_19-0.2.1-1PGSTY.el10.noarch.rpm
index_advisor_190.2.1el10.aarch64pigsty10.4 KiBindex_advisor_19-0.2.1-1PGSTY.el10.noarch.rpm
postgresql-19-index-advisor0.2.1d12.x86_64pigsty6.1 KiBpostgresql-19-index-advisor_0.2.1-1PGSTY~bookworm_all.deb
postgresql-19-index-advisor0.2.1d12.aarch64pigsty6.1 KiBpostgresql-19-index-advisor_0.2.1-1PGSTY~bookworm_all.deb
postgresql-19-index-advisor0.2.1d13.x86_64pigsty6.1 KiBpostgresql-19-index-advisor_0.2.1-1PGSTY~trixie_all.deb
postgresql-19-index-advisor0.2.1d13.aarch64pigsty6.1 KiBpostgresql-19-index-advisor_0.2.1-1PGSTY~trixie_all.deb
postgresql-19-index-advisor0.2.1u22.x86_64pigsty6.3 KiBpostgresql-19-index-advisor_0.2.1-1PGSTY~jammy_all.deb
postgresql-19-index-advisor0.2.1u22.aarch64pigsty6.3 KiBpostgresql-19-index-advisor_0.2.1-1PGSTY~jammy_all.deb
postgresql-19-index-advisor0.2.1u24.x86_64pigsty6.3 KiBpostgresql-19-index-advisor_0.2.1-1PGSTY~noble_all.deb
postgresql-19-index-advisor0.2.1u24.aarch64pigsty6.3 KiBpostgresql-19-index-advisor_0.2.1-1PGSTY~noble_all.deb
postgresql-19-index-advisor0.2.1u26.x86_64pigsty6.3 KiBpostgresql-19-index-advisor_0.2.1-1PGSTY~resolute_all.deb
postgresql-19-index-advisor0.2.1u26.aarch64pigsty6.3 KiBpostgresql-19-index-advisor_0.2.1-1PGSTY~resolute_all.deb
PackageVersionOSORGSIZEFile URL
index_advisor_180.2.1el8.x86_64pigsty10.4 KiBindex_advisor_18-0.2.1-1PGSTY.el8.noarch.rpm
index_advisor_180.2.1el8.aarch64pigsty10.4 KiBindex_advisor_18-0.2.1-1PGSTY.el8.noarch.rpm
index_advisor_180.2.1el9.x86_64pigsty10.2 KiBindex_advisor_18-0.2.1-1PGSTY.el9.noarch.rpm
index_advisor_180.2.1el9.aarch64pigsty10.2 KiBindex_advisor_18-0.2.1-1PGSTY.el9.noarch.rpm
index_advisor_180.2.1el10.x86_64pigsty10.4 KiBindex_advisor_18-0.2.1-1PGSTY.el10.noarch.rpm
index_advisor_180.2.1el10.aarch64pigsty10.4 KiBindex_advisor_18-0.2.1-1PGSTY.el10.noarch.rpm
postgresql-18-index-advisor0.2.1d12.x86_64pigsty6.1 KiBpostgresql-18-index-advisor_0.2.1-1PGSTY~bookworm_all.deb
postgresql-18-index-advisor0.2.1d12.aarch64pigsty6.1 KiBpostgresql-18-index-advisor_0.2.1-1PGSTY~bookworm_all.deb
postgresql-18-index-advisor0.2.1d13.x86_64pigsty6.1 KiBpostgresql-18-index-advisor_0.2.1-1PGSTY~trixie_all.deb
postgresql-18-index-advisor0.2.1d13.aarch64pigsty6.1 KiBpostgresql-18-index-advisor_0.2.1-1PGSTY~trixie_all.deb
postgresql-18-index-advisor0.2.1u22.x86_64pigsty6.3 KiBpostgresql-18-index-advisor_0.2.1-1PGSTY~jammy_all.deb
postgresql-18-index-advisor0.2.1u22.aarch64pigsty6.3 KiBpostgresql-18-index-advisor_0.2.1-1PGSTY~jammy_all.deb
postgresql-18-index-advisor0.2.1u24.x86_64pigsty6.2 KiBpostgresql-18-index-advisor_0.2.1-1PGSTY~noble_all.deb
postgresql-18-index-advisor0.2.1u24.aarch64pigsty6.2 KiBpostgresql-18-index-advisor_0.2.1-1PGSTY~noble_all.deb
postgresql-18-index-advisor0.2.1u26.x86_64pigsty6.3 KiBpostgresql-18-index-advisor_0.2.1-1PGSTY~resolute_all.deb
postgresql-18-index-advisor0.2.1u26.aarch64pigsty6.3 KiBpostgresql-18-index-advisor_0.2.1-1PGSTY~resolute_all.deb
PackageVersionOSORGSIZEFile URL
index_advisor_170.2.1el8.x86_64pigsty10.4 KiBindex_advisor_17-0.2.1-1PGSTY.el8.noarch.rpm
index_advisor_170.2.1el8.aarch64pigsty10.4 KiBindex_advisor_17-0.2.1-1PGSTY.el8.noarch.rpm
index_advisor_170.2.1el9.x86_64pigsty10.2 KiBindex_advisor_17-0.2.1-1PGSTY.el9.noarch.rpm
index_advisor_170.2.1el9.aarch64pigsty10.2 KiBindex_advisor_17-0.2.1-1PGSTY.el9.noarch.rpm
index_advisor_170.2.1el10.x86_64pigsty10.4 KiBindex_advisor_17-0.2.1-1PGSTY.el10.noarch.rpm
index_advisor_170.2.1el10.aarch64pigsty10.4 KiBindex_advisor_17-0.2.1-1PGSTY.el10.noarch.rpm
postgresql-17-index-advisor0.2.1d12.x86_64pigsty6.1 KiBpostgresql-17-index-advisor_0.2.1-1PGSTY~bookworm_all.deb
postgresql-17-index-advisor0.2.1d12.aarch64pigsty6.1 KiBpostgresql-17-index-advisor_0.2.1-1PGSTY~bookworm_all.deb
postgresql-17-index-advisor0.2.1d13.x86_64pigsty6.1 KiBpostgresql-17-index-advisor_0.2.1-1PGSTY~trixie_all.deb
postgresql-17-index-advisor0.2.1d13.aarch64pigsty6.1 KiBpostgresql-17-index-advisor_0.2.1-1PGSTY~trixie_all.deb
postgresql-17-index-advisor0.2.1u22.x86_64pigsty6.3 KiBpostgresql-17-index-advisor_0.2.1-1PGSTY~jammy_all.deb
postgresql-17-index-advisor0.2.1u22.aarch64pigsty6.3 KiBpostgresql-17-index-advisor_0.2.1-1PGSTY~jammy_all.deb
postgresql-17-index-advisor0.2.1u24.x86_64pigsty6.2 KiBpostgresql-17-index-advisor_0.2.1-1PGSTY~noble_all.deb
postgresql-17-index-advisor0.2.1u24.aarch64pigsty6.2 KiBpostgresql-17-index-advisor_0.2.1-1PGSTY~noble_all.deb
postgresql-17-index-advisor0.2.1u26.x86_64pigsty6.3 KiBpostgresql-17-index-advisor_0.2.1-1PGSTY~resolute_all.deb
postgresql-17-index-advisor0.2.1u26.aarch64pigsty6.3 KiBpostgresql-17-index-advisor_0.2.1-1PGSTY~resolute_all.deb
PackageVersionOSORGSIZEFile URL
index_advisor_160.2.1el8.x86_64pigsty10.4 KiBindex_advisor_16-0.2.1-1PGSTY.el8.noarch.rpm
index_advisor_160.2.1el8.aarch64pigsty10.4 KiBindex_advisor_16-0.2.1-1PGSTY.el8.noarch.rpm
index_advisor_160.2.1el9.x86_64pigsty10.2 KiBindex_advisor_16-0.2.1-1PGSTY.el9.noarch.rpm
index_advisor_160.2.1el9.aarch64pigsty10.2 KiBindex_advisor_16-0.2.1-1PGSTY.el9.noarch.rpm
index_advisor_160.2.1el10.x86_64pigsty10.4 KiBindex_advisor_16-0.2.1-1PGSTY.el10.noarch.rpm
index_advisor_160.2.1el10.aarch64pigsty10.4 KiBindex_advisor_16-0.2.1-1PGSTY.el10.noarch.rpm
postgresql-16-index-advisor0.2.1d12.x86_64pigsty6.1 KiBpostgresql-16-index-advisor_0.2.1-1PGSTY~bookworm_all.deb
postgresql-16-index-advisor0.2.1d12.aarch64pigsty6.1 KiBpostgresql-16-index-advisor_0.2.1-1PGSTY~bookworm_all.deb
postgresql-16-index-advisor0.2.1d13.x86_64pigsty6.1 KiBpostgresql-16-index-advisor_0.2.1-1PGSTY~trixie_all.deb
postgresql-16-index-advisor0.2.1d13.aarch64pigsty6.1 KiBpostgresql-16-index-advisor_0.2.1-1PGSTY~trixie_all.deb
postgresql-16-index-advisor0.2.1u22.x86_64pigsty6.2 KiBpostgresql-16-index-advisor_0.2.1-1PGSTY~jammy_all.deb
postgresql-16-index-advisor0.2.1u22.aarch64pigsty6.2 KiBpostgresql-16-index-advisor_0.2.1-1PGSTY~jammy_all.deb
postgresql-16-index-advisor0.2.1u24.x86_64pigsty6.2 KiBpostgresql-16-index-advisor_0.2.1-1PGSTY~noble_all.deb
postgresql-16-index-advisor0.2.1u24.aarch64pigsty6.2 KiBpostgresql-16-index-advisor_0.2.1-1PGSTY~noble_all.deb
postgresql-16-index-advisor0.2.1u26.x86_64pigsty6.3 KiBpostgresql-16-index-advisor_0.2.1-1PGSTY~resolute_all.deb
postgresql-16-index-advisor0.2.1u26.aarch64pigsty6.3 KiBpostgresql-16-index-advisor_0.2.1-1PGSTY~resolute_all.deb
PackageVersionOSORGSIZEFile URL
index_advisor_150.2.1el8.x86_64pigsty10.4 KiBindex_advisor_15-0.2.1-1PGSTY.el8.noarch.rpm
index_advisor_150.2.1el8.aarch64pigsty10.4 KiBindex_advisor_15-0.2.1-1PGSTY.el8.noarch.rpm
index_advisor_150.2.1el9.x86_64pigsty10.2 KiBindex_advisor_15-0.2.1-1PGSTY.el9.noarch.rpm
index_advisor_150.2.1el9.aarch64pigsty10.2 KiBindex_advisor_15-0.2.1-1PGSTY.el9.noarch.rpm
index_advisor_150.2.1el10.x86_64pigsty10.4 KiBindex_advisor_15-0.2.1-1PGSTY.el10.noarch.rpm
index_advisor_150.2.1el10.aarch64pigsty10.4 KiBindex_advisor_15-0.2.1-1PGSTY.el10.noarch.rpm
postgresql-15-index-advisor0.2.1d12.x86_64pigsty6.1 KiBpostgresql-15-index-advisor_0.2.1-1PGSTY~bookworm_all.deb
postgresql-15-index-advisor0.2.1d12.aarch64pigsty6.1 KiBpostgresql-15-index-advisor_0.2.1-1PGSTY~bookworm_all.deb
postgresql-15-index-advisor0.2.1d13.x86_64pigsty6.1 KiBpostgresql-15-index-advisor_0.2.1-1PGSTY~trixie_all.deb
postgresql-15-index-advisor0.2.1d13.aarch64pigsty6.1 KiBpostgresql-15-index-advisor_0.2.1-1PGSTY~trixie_all.deb
postgresql-15-index-advisor0.2.1u22.x86_64pigsty6.3 KiBpostgresql-15-index-advisor_0.2.1-1PGSTY~jammy_all.deb
postgresql-15-index-advisor0.2.1u22.aarch64pigsty6.3 KiBpostgresql-15-index-advisor_0.2.1-1PGSTY~jammy_all.deb
postgresql-15-index-advisor0.2.1u24.x86_64pigsty6.3 KiBpostgresql-15-index-advisor_0.2.1-1PGSTY~noble_all.deb
postgresql-15-index-advisor0.2.1u24.aarch64pigsty6.3 KiBpostgresql-15-index-advisor_0.2.1-1PGSTY~noble_all.deb
postgresql-15-index-advisor0.2.1u26.x86_64pigsty6.3 KiBpostgresql-15-index-advisor_0.2.1-1PGSTY~resolute_all.deb
postgresql-15-index-advisor0.2.1u26.aarch64pigsty6.3 KiBpostgresql-15-index-advisor_0.2.1-1PGSTY~resolute_all.deb

Source

pig build pkg index_advisor;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install index_advisor;		# install by package name

pig install index_advisor -v 19;   # install for PG 19
pig install index_advisor -v 18;   # install for PG 18
pig install index_advisor -v 17;   # install for PG 17
pig install index_advisor -v 16;   # install for PG 16
pig install index_advisor -v 15;   # install for PG 15

Create this extension with:

CREATE EXTENSION index_advisor CASCADE; -- requires hypopg

Usage

Sources:

index_advisor 0.2.1 uses HypoPG to compare planner costs with hypothetical indexes. It returns recommendations, not measured execution-time guarantees, and does not create the recommended physical indexes.

Core Workflow

Install the required hypopg extension first, with the privileges its installation requires. This SQL extension needs no preload or restart.

CREATE EXTENSION hypopg;
CREATE EXTENSION index_advisor;
CREATE TABLE book (id bigint PRIMARY KEY, title text NOT NULL);
SELECT * FROM index_advisor('SELECT id FROM book WHERE title = $1');

index_advisor(query text) accepts a parameterized query and returns before/after startup and total cost values, index_statements and errors. Inspect the suggested DDL and real workload before creating an index. View and materialized-view support depends on what the advisor can resolve to underlying tables.

0.2.1 Corrections and Limits

Version 0.2.1 fixes qualification of HypoPG calls when HypoPG uses another schema, non-greedy removal of comments, and cleanup of the advisor’s own prepared statement. Update installed databases with ALTER EXTENSION index_advisor UPDATE TO '0.2.1' after installing the new SQL files.

Run analysis with deliberate table permissions and representative statistics. Planning cost does not account for every operational cost: additional indexes consume disk and slow writes, and should be validated against production query shapes before deployment.

Table reader