cockroachdb / cockroachdb/cockroach

sql/inspect: support expression indexes in index consistency checks

Open
#154,772 0 comments 0 reactions 0 assignees View on GitHub
C-enhancement T-sql-foundations
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

INSPECT cannot check expression indexes for consistency. They are filtered out to avoid query failures.

Expression indexes use hidden virtual columns (e.g., crdb_internal_idx_expr_0) that are inaccessible. The INSPECT query builder tries to reference these columns by name in LOOKUP JOINs, causing: `inspect-index-consistency-check: column "crdb_internal_idx_expr" does not exist`

One potential solution is instead of referring to the column by name, we could reference it by column ID or use the expression directly. Or possibly we could exclude inaccessible columns from joins but are still able to verify index validity.

Jira issue: CRDB-55110

Epic CRDB-55075

Contributor guide

Open the contributing guide

Research direction

Start in the sql/inspect entry points and trace the INSPECT query builder's LOOKUP JOIN handling for expression indexes. Reproduce the failure involving hidden virtual columns such as crdb_internal_idx_expr_0, then determine how expression indexes can be checked without referencing inaccessible columns. Done means INSPECT index consistency checks work for expression indexes without query failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.