hypopg
Hypothetical indexes for PostgreSQL
hypopg : Hypothetical indexes for PostgreSQL
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 2790 | hypopg | hypopg | 1.4.3 |
FEAT | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| Need By | index_advisor |
| See Also | online_advisor pg_qualstats index_advisor pg_hint_plan pg_stat_plans plan_filter pg_track_optimizer pg_strom pg_orca pg_regresql |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG | 1.4.3 |
18 17 16 15 14 | hypopg |
- |
| RPM | PGDG | 1.4.3 |
18 17 16 15 14 | hypopg_$v |
- |
| DEB | PGDG | 1.4.3 |
18 17 16 15 14 | postgresql-$v-hypopg |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 |
| el8.aarch64 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 |
| el9.x86_64 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 |
| el9.aarch64 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 |
| el10.x86_64 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 |
| el10.aarch64 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 |
| d12.x86_64 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 |
| d12.aarch64 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 |
| d13.x86_64 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 |
| d13.aarch64 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 |
| u22.x86_64 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 |
| u22.aarch64 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 |
| u24.x86_64 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 |
| u24.aarch64 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 |
| u26.x86_64 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 |
| u26.aarch64 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 | PGDG 1.4.3 |
Source
github.com/HypoPG/hypopg
Install
Make sure PGDG repo available:
Install this extension with pig:
Create this extension with:
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