manage_hypothetical_indexes
Test PostgreSQL index performance by creating hypothetical indexes in memory to analyze query plans without building physical indexes, enabling performance optimization through what-if analysis.
Instructions
Manage HypoPG hypothetical indexes for testing.
HypoPG allows you to create "hypothetical" indexes that exist only in memory and can be used to test query plans without the overhead of creating real indexes.
Actions:
create: Create a new hypothetical index by specifying table and columns
list: List all current hypothetical indexes
drop: Drop a specific hypothetical index
reset: Drop all hypothetical indexes
estimate_size: Estimate the size of a hypothetical index
check: Check HypoPG extension status and availability
hide: Hide an existing real index from the query planner (useful for testing what-if scenarios)
unhide: Unhide a previously hidden index
list_hidden: List all currently hidden indexes
explain_with_index: Create a hypothetical index and explain a query with before/after comparison
This is useful for:
Testing if an index would improve a query
Comparing different index strategies
Estimating index storage requirements
Testing query performance without specific existing indexes (hide)
Simulating index removal scenarios
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Action to perform | |
| table | No | Table name (required for create, estimate_size, explain_with_index) | |
| columns | No | Column names for the index (required for create, estimate_size, explain_with_index) | |
| index_type | No | Type of index to create | btree |
| unique | No | Whether the index should be unique | |
| index_id | No | Index OID (required for drop, hide, unhide) | |
| query | No | SQL query to explain (required for explain_with_index) | |
| schema | No | Schema name for the table (optional, for create and explain_with_index) | |
| where | No | Partial index WHERE condition (optional, for create) | |
| include | No | Columns to include in INCLUDE clause (optional, for create) |