hypopg
Hypothetical indexes for PostgreSQL
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
hypopg | 1.4.3 | FEAT | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 2790 | hypopg | No | Yes | No | Yes | No | Yes | - |
| Related | online_advisor pg_qualstats index_advisor pg_hint_plan pg_stat_plans plan_filter pg_track_optimizer pg_strom pg_orca pg_regresql |
|---|---|
| Depended By | index_advisor |
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PGDG | 1.4.3 | 1817161514 | hypopg | - |
| RPM | PGDG | 1.4.3 | 1817161514 | hypopg_$v | - |
| DEB | PGDG | 1.4.3 | 1817161514 | postgresql-$v-hypopg | - |
Install
You can install hypopg directly. First, make sure the PGDG repository is added and enabled:
Install the extension using pig or apt/yum/dnf:
Install
pig
dnf
apt
Create Extension:
Usage
HypoPG lets you create hypothetical (virtual) indexes that exist only in the current session and are considered by EXPLAIN (without ANALYZE) for query planning. This enables testing the impact of indexes without the cost of actually creating them.
Functions
| Function | Description |
|---|---|
hypopg_create_index(query text) | Create a hypothetical index using CREATE INDEX syntax |
hypopg_list_indexes() | List all hypothetical indexes in the session |
hypopg_drop_index(oid) | Drop a specific hypothetical index by OID |
hypopg_reset() | Drop all hypothetical indexes |
hypopg() | Return hypothetical indexes in pg_index-like format |
Workflow
Create a test table and check the baseline plan:
Create a hypothetical index:
Check the plan with the hypothetical index:
List and manage hypothetical indexes:
Limitations
- Only
EXPLAINwithoutANALYZEwill consider hypothetical indexes - Hypothetical indexes exist only in the current backend session
- Other concurrent connections are not affected
- Index names and some CREATE INDEX options are ignored
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)