Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions index-advisor.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ WHERE last_access_time IS NOT NULL AND percentage_access_0 + percentage_access_0

## Hypothetical indexes

Hypothetical indexes (Hypo Indexes) are created using SQL comments, similar to [query hints](/optimizer-hints.md), rather than through the `CREATE INDEX` statement. This approach enables lightweight experimentation with indexes without the overhead of physically materializing them.
Hypothetical indexes (Hypo Indexes) use the same `/*+ ... */` comment syntax as [optimizer hints](/optimizer-hints.md), rather than the `CREATE INDEX` statement. The `HYPO_INDEX` hint is dedicated to hypothetical indexes and currently takes effect only in `EXPLAIN` statements. This approach enables lightweight experimentation with indexes without the overhead of physically materializing them.

For example, the `/*+ HYPO_INDEX(t, idx_ab, a, b) */` comment instructs the query planner to create a hypothetical index named `idx_ab` on table `t` for columns `a` and `b`. The planner generates the index's metadata but does not physically materialize it. If applicable, the planner considers this hypothetical index during query optimization without incurring the costs associated with index creation.
Comment thread
qiancai marked this conversation as resolved.

The `RECOMMEND INDEX` advisor uses hypothetical indexes for "What-If" analysis to evaluate potential benefits of different indexes. You can also use hypothetical indexes directly to experiment with index designs before proceeding to create them.

The following example shows a query using a hypothetical index:
The following example shows an `EXPLAIN` statement using a hypothetical index:

```sql
CREATE TABLE t(a INT, b INT, c INT);
Expand Down