跳转到主要内容

index_advisor

Query index advisor

index_advisor : Query index advisor

Overview

ID Extension Package Version Category License Language
2800 index_advisor index_advisor 0.2.0 FEAT PostgreSQL SQL
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
----d-r No No No Yes yes no
Upstream 0.2.1; pkg 0.2.0; planner estimates only.

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT PIGSTY 0.2.0 18 17 16 15 14 index_advisor hypopg
RPM PIGSTY 0.2.0 18 17 16 15 14 index_advisor_$v -
DEB PIGSTY 0.2.0 18 17 16 15 14 postgresql-$v-index-advisor -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0
el8.aarch64 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0
el9.x86_64 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0
el9.aarch64 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0
el10.x86_64 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0
el10.aarch64 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0
d12.x86_64 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0
d12.aarch64 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0
d13.x86_64 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0
d13.aarch64 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0
u22.x86_64 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0
u22.aarch64 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0
u24.x86_64 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0
u24.aarch64 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0
u26.x86_64 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0
u26.aarch64 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0 PIGSTY 0.2.0
Package Version OS ORG SIZE File URL
index_advisor_18 0.2.0 el8.x86_64 pigsty 10.2 KiB index_advisor_18-0.2.0-1PIGSTY.el8.x86_64.rpm
index_advisor_18 0.2.0 el8.aarch64 pigsty 10.2 KiB index_advisor_18-0.2.0-1PIGSTY.el8.aarch64.rpm
index_advisor_18 0.2.0 el9.x86_64 pigsty 10.1 KiB index_advisor_18-0.2.0-1PIGSTY.el9.x86_64.rpm
index_advisor_18 0.2.0 el9.aarch64 pigsty 10.1 KiB index_advisor_18-0.2.0-1PIGSTY.el9.aarch64.rpm
index_advisor_18 0.2.0 el10.x86_64 pigsty 10.2 KiB index_advisor_18-0.2.0-1PIGSTY.el10.x86_64.rpm
index_advisor_18 0.2.0 el10.aarch64 pigsty 10.2 KiB index_advisor_18-0.2.0-1PIGSTY.el10.aarch64.rpm
postgresql-18-index-advisor 0.2.0 d12.x86_64 pigsty 5.6 KiB postgresql-18-index-advisor_0.2.0-1PIGSTY~bookworm_amd64.deb
postgresql-18-index-advisor 0.2.0 d12.aarch64 pigsty 5.6 KiB postgresql-18-index-advisor_0.2.0-1PIGSTY~bookworm_arm64.deb
postgresql-18-index-advisor 0.2.0 d13.x86_64 pigsty 5.6 KiB postgresql-18-index-advisor_0.2.0-1PIGSTY~trixie_amd64.deb
postgresql-18-index-advisor 0.2.0 d13.aarch64 pigsty 5.6 KiB postgresql-18-index-advisor_0.2.0-1PIGSTY~trixie_arm64.deb
postgresql-18-index-advisor 0.2.0 u22.x86_64 pigsty 5.6 KiB postgresql-18-index-advisor_0.2.0-1PIGSTY~jammy_amd64.deb
postgresql-18-index-advisor 0.2.0 u22.aarch64 pigsty 5.6 KiB postgresql-18-index-advisor_0.2.0-1PIGSTY~jammy_arm64.deb
postgresql-18-index-advisor 0.2.0 u24.x86_64 pigsty 5.6 KiB postgresql-18-index-advisor_0.2.0-1PIGSTY~noble_amd64.deb
postgresql-18-index-advisor 0.2.0 u24.aarch64 pigsty 5.6 KiB postgresql-18-index-advisor_0.2.0-1PIGSTY~noble_arm64.deb
postgresql-18-index-advisor 0.2.0 u26.x86_64 pigsty 5.6 KiB postgresql-18-index-advisor_0.2.0-1PIGSTY~resolute_amd64.deb
postgresql-18-index-advisor 0.2.0 u26.aarch64 pigsty 5.6 KiB postgresql-18-index-advisor_0.2.0-1PIGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
index_advisor_17 0.2.0 el8.x86_64 pigsty 10.2 KiB index_advisor_17-0.2.0-1PIGSTY.el8.x86_64.rpm
index_advisor_17 0.2.0 el8.aarch64 pigsty 10.2 KiB index_advisor_17-0.2.0-1PIGSTY.el8.aarch64.rpm
index_advisor_17 0.2.0 el9.x86_64 pigsty 10.1 KiB index_advisor_17-0.2.0-1PIGSTY.el9.x86_64.rpm
index_advisor_17 0.2.0 el9.aarch64 pigsty 10.1 KiB index_advisor_17-0.2.0-1PIGSTY.el9.aarch64.rpm
index_advisor_17 0.2.0 el10.x86_64 pigsty 10.2 KiB index_advisor_17-0.2.0-1PIGSTY.el10.x86_64.rpm
index_advisor_17 0.2.0 el10.aarch64 pigsty 10.2 KiB index_advisor_17-0.2.0-1PIGSTY.el10.aarch64.rpm
postgresql-17-index-advisor 0.2.0 d12.x86_64 pigsty 5.6 KiB postgresql-17-index-advisor_0.2.0-1PIGSTY~bookworm_amd64.deb
postgresql-17-index-advisor 0.2.0 d12.aarch64 pigsty 5.6 KiB postgresql-17-index-advisor_0.2.0-1PIGSTY~bookworm_arm64.deb
postgresql-17-index-advisor 0.2.0 d13.x86_64 pigsty 5.6 KiB postgresql-17-index-advisor_0.2.0-1PIGSTY~trixie_amd64.deb
postgresql-17-index-advisor 0.2.0 d13.aarch64 pigsty 5.6 KiB postgresql-17-index-advisor_0.2.0-1PIGSTY~trixie_arm64.deb
postgresql-17-index-advisor 0.2.0 u22.x86_64 pigsty 5.6 KiB postgresql-17-index-advisor_0.2.0-1PIGSTY~jammy_amd64.deb
postgresql-17-index-advisor 0.2.0 u22.aarch64 pigsty 5.6 KiB postgresql-17-index-advisor_0.2.0-1PIGSTY~jammy_arm64.deb
postgresql-17-index-advisor 0.2.0 u24.x86_64 pigsty 5.6 KiB postgresql-17-index-advisor_0.2.0-1PIGSTY~noble_amd64.deb
postgresql-17-index-advisor 0.2.0 u24.aarch64 pigsty 5.6 KiB postgresql-17-index-advisor_0.2.0-1PIGSTY~noble_arm64.deb
postgresql-17-index-advisor 0.2.0 u26.x86_64 pigsty 5.6 KiB postgresql-17-index-advisor_0.2.0-1PIGSTY~resolute_amd64.deb
postgresql-17-index-advisor 0.2.0 u26.aarch64 pigsty 5.6 KiB postgresql-17-index-advisor_0.2.0-1PIGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
index_advisor_16 0.2.0 el8.x86_64 pigsty 10.2 KiB index_advisor_16-0.2.0-1PIGSTY.el8.x86_64.rpm
index_advisor_16 0.2.0 el8.aarch64 pigsty 10.2 KiB index_advisor_16-0.2.0-1PIGSTY.el8.aarch64.rpm
index_advisor_16 0.2.0 el9.x86_64 pigsty 10.1 KiB index_advisor_16-0.2.0-1PIGSTY.el9.x86_64.rpm
index_advisor_16 0.2.0 el9.aarch64 pigsty 10.1 KiB index_advisor_16-0.2.0-1PIGSTY.el9.aarch64.rpm
index_advisor_16 0.2.0 el10.x86_64 pigsty 10.2 KiB index_advisor_16-0.2.0-1PIGSTY.el10.x86_64.rpm
index_advisor_16 0.2.0 el10.aarch64 pigsty 10.2 KiB index_advisor_16-0.2.0-1PIGSTY.el10.aarch64.rpm
postgresql-16-index-advisor 0.2.0 d12.x86_64 pigsty 5.6 KiB postgresql-16-index-advisor_0.2.0-1PIGSTY~bookworm_amd64.deb
postgresql-16-index-advisor 0.2.0 d12.aarch64 pigsty 5.6 KiB postgresql-16-index-advisor_0.2.0-1PIGSTY~bookworm_arm64.deb
postgresql-16-index-advisor 0.2.0 d13.x86_64 pigsty 5.6 KiB postgresql-16-index-advisor_0.2.0-1PIGSTY~trixie_amd64.deb
postgresql-16-index-advisor 0.2.0 d13.aarch64 pigsty 5.6 KiB postgresql-16-index-advisor_0.2.0-1PIGSTY~trixie_arm64.deb
postgresql-16-index-advisor 0.2.0 u22.x86_64 pigsty 5.6 KiB postgresql-16-index-advisor_0.2.0-1PIGSTY~jammy_amd64.deb
postgresql-16-index-advisor 0.2.0 u22.aarch64 pigsty 5.6 KiB postgresql-16-index-advisor_0.2.0-1PIGSTY~jammy_arm64.deb
postgresql-16-index-advisor 0.2.0 u24.x86_64 pigsty 5.6 KiB postgresql-16-index-advisor_0.2.0-1PIGSTY~noble_amd64.deb
postgresql-16-index-advisor 0.2.0 u24.aarch64 pigsty 5.6 KiB postgresql-16-index-advisor_0.2.0-1PIGSTY~noble_arm64.deb
postgresql-16-index-advisor 0.2.0 u26.x86_64 pigsty 5.6 KiB postgresql-16-index-advisor_0.2.0-1PIGSTY~resolute_amd64.deb
postgresql-16-index-advisor 0.2.0 u26.aarch64 pigsty 5.6 KiB postgresql-16-index-advisor_0.2.0-1PIGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
index_advisor_15 0.2.0 el8.x86_64 pigsty 10.2 KiB index_advisor_15-0.2.0-1PIGSTY.el8.x86_64.rpm
index_advisor_15 0.2.0 el8.aarch64 pigsty 10.2 KiB index_advisor_15-0.2.0-1PIGSTY.el8.aarch64.rpm
index_advisor_15 0.2.0 el9.x86_64 pigsty 10.1 KiB index_advisor_15-0.2.0-1PIGSTY.el9.x86_64.rpm
index_advisor_15 0.2.0 el9.aarch64 pigsty 10.1 KiB index_advisor_15-0.2.0-1PIGSTY.el9.aarch64.rpm
index_advisor_15 0.2.0 el10.x86_64 pigsty 10.2 KiB index_advisor_15-0.2.0-1PIGSTY.el10.x86_64.rpm
index_advisor_15 0.2.0 el10.aarch64 pigsty 10.2 KiB index_advisor_15-0.2.0-1PIGSTY.el10.aarch64.rpm
postgresql-15-index-advisor 0.2.0 d12.x86_64 pigsty 5.6 KiB postgresql-15-index-advisor_0.2.0-1PIGSTY~bookworm_amd64.deb
postgresql-15-index-advisor 0.2.0 d12.aarch64 pigsty 5.6 KiB postgresql-15-index-advisor_0.2.0-1PIGSTY~bookworm_arm64.deb
postgresql-15-index-advisor 0.2.0 d13.x86_64 pigsty 5.6 KiB postgresql-15-index-advisor_0.2.0-1PIGSTY~trixie_amd64.deb
postgresql-15-index-advisor 0.2.0 d13.aarch64 pigsty 5.6 KiB postgresql-15-index-advisor_0.2.0-1PIGSTY~trixie_arm64.deb
postgresql-15-index-advisor 0.2.0 u22.x86_64 pigsty 5.6 KiB postgresql-15-index-advisor_0.2.0-1PIGSTY~jammy_amd64.deb
postgresql-15-index-advisor 0.2.0 u22.aarch64 pigsty 5.6 KiB postgresql-15-index-advisor_0.2.0-1PIGSTY~jammy_arm64.deb
postgresql-15-index-advisor 0.2.0 u24.x86_64 pigsty 5.6 KiB postgresql-15-index-advisor_0.2.0-1PIGSTY~noble_amd64.deb
postgresql-15-index-advisor 0.2.0 u24.aarch64 pigsty 5.6 KiB postgresql-15-index-advisor_0.2.0-1PIGSTY~noble_arm64.deb
postgresql-15-index-advisor 0.2.0 u26.x86_64 pigsty 5.6 KiB postgresql-15-index-advisor_0.2.0-1PIGSTY~resolute_amd64.deb
postgresql-15-index-advisor 0.2.0 u26.aarch64 pigsty 5.6 KiB postgresql-15-index-advisor_0.2.0-1PIGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
index_advisor_14 0.2.0 el8.x86_64 pigsty 10.2 KiB index_advisor_14-0.2.0-1PIGSTY.el8.x86_64.rpm
index_advisor_14 0.2.0 el8.aarch64 pigsty 10.2 KiB index_advisor_14-0.2.0-1PIGSTY.el8.aarch64.rpm
index_advisor_14 0.2.0 el9.x86_64 pigsty 10.1 KiB index_advisor_14-0.2.0-1PIGSTY.el9.x86_64.rpm
index_advisor_14 0.2.0 el9.aarch64 pigsty 10.1 KiB index_advisor_14-0.2.0-1PIGSTY.el9.aarch64.rpm
index_advisor_14 0.2.0 el10.x86_64 pigsty 10.2 KiB index_advisor_14-0.2.0-1PIGSTY.el10.x86_64.rpm
index_advisor_14 0.2.0 el10.aarch64 pigsty 10.2 KiB index_advisor_14-0.2.0-1PIGSTY.el10.aarch64.rpm
postgresql-14-index-advisor 0.2.0 d12.x86_64 pigsty 5.6 KiB postgresql-14-index-advisor_0.2.0-1PIGSTY~bookworm_amd64.deb
postgresql-14-index-advisor 0.2.0 d12.aarch64 pigsty 5.6 KiB postgresql-14-index-advisor_0.2.0-1PIGSTY~bookworm_arm64.deb
postgresql-14-index-advisor 0.2.0 d13.x86_64 pigsty 5.6 KiB postgresql-14-index-advisor_0.2.0-1PIGSTY~trixie_amd64.deb
postgresql-14-index-advisor 0.2.0 d13.aarch64 pigsty 5.6 KiB postgresql-14-index-advisor_0.2.0-1PIGSTY~trixie_arm64.deb
postgresql-14-index-advisor 0.2.0 u22.x86_64 pigsty 5.6 KiB postgresql-14-index-advisor_0.2.0-1PIGSTY~jammy_amd64.deb
postgresql-14-index-advisor 0.2.0 u22.aarch64 pigsty 5.6 KiB postgresql-14-index-advisor_0.2.0-1PIGSTY~jammy_arm64.deb
postgresql-14-index-advisor 0.2.0 u24.x86_64 pigsty 5.6 KiB postgresql-14-index-advisor_0.2.0-1PIGSTY~noble_amd64.deb
postgresql-14-index-advisor 0.2.0 u24.aarch64 pigsty 5.6 KiB postgresql-14-index-advisor_0.2.0-1PIGSTY~noble_arm64.deb
postgresql-14-index-advisor 0.2.0 u26.x86_64 pigsty 5.6 KiB postgresql-14-index-advisor_0.2.0-1PIGSTY~resolute_amd64.deb
postgresql-14-index-advisor 0.2.0 u26.aarch64 pigsty 5.6 KiB postgresql-14-index-advisor_0.2.0-1PIGSTY~resolute_arm64.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 via package name, for the active PG version

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
pig install index_advisor -v 14;   # install for PG 14

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.