Skip to content

sql: emit inverted index recommendations for types that can be both forward and inverted indexed #91777

@jordanlewis

Description

@jordanlewis

Currently, the index recommendation engine is unable to provide inverted index recommendations on columns whose types are also forward indexable.

This includes the TEXT type which can be inverted indexed with trigrams, and will include array types once #91762 is merged.

Solving this issue will require some refactoring - the index recommender represents hypothetical indexes as a slice of columns, without any extra space to store metadata like inverted vs not. The choice to provide an inverted vs forward index is made by examining the column types. Instead, we'll need to represent hypothetical indexes with a struct that contains the inverted vs not bit as well as the columns in the index.

We'll also need to make sure that we don't de-duplicate hypothetical indexes if they're identical save for their inverted bit, and make sure to generate both inverted and forward hypothetical indexes if both are supported on a type, instead of just one.

Jira issue: CRDB-21421

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-sql-explainIssues related to EXPLAIN and EXPLAIN ANALYZE improvementsC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)E-quick-winLikely to be a quick win for someone experienced.T-sql-queriesSQL Queries Team

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions