Skip to content

opt: add histogram type field to persisted histograms in table statistics #50655

@madelynnblue

Description

@madelynnblue

Table stats recently gained inverted histogram data, but it is not marked as such, instead the system relies on some assumptions about column types to know if a histogram is from an inverted index or not. We need to add an indexParameter column to table stats to describe what kind of index the histogram is from. This will be necessary when:

  1. We support types that have inverted indexes in PKs, and need to generate histograms for both their forward and inverted indexes.
  2. We support different geo index configs, and need to know which a histogram is generated from, since a user might have different inverted indexes on the same column with different configurations.
  3. We support full text or other kinds of inverted indexes that have user-specifiable parameters.

Whatever this indexParameter column holds, it must be easily consumable by the stats code such that it is easy to find the best histogram to use. Since some of these index configs can contain arbitrary strings or numbers, it may make sense to use JSON instead of STRING so we don't have to build a parser to consume the data.

Jira issue: CRDB-4105

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-sql-optimizerSQL logical planning and optimizations.A-sql-table-statsTable statistics (and their automatic refresh).C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)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