Skip to content

sql,sqlbase: maintain an index free-list on table descriptor #47981

@ajwerner

Description

@ajwerner

Is your feature request related to a problem? Please describe.

As we move towards constructing more indexes in schema changes and swapping them out after construction, we risk creating very high index ids. This is a bummer because index IDs are varint encoded and currently we almost always can fit that ID into a single byte. After we drop old indexes, we could easily reuse them are the relevant range has been cleared.

Describe the solution you'd like

Keep an index id freelist on the table descriptor and add to it after clearing the data in the GC Job.

Describe alternatives you've considered

Just letting the IDs get big.

Additional context

Another place where a free list might be valuable is for descriptor IDs. We could use a table to store those free IDs.

Jira issue: CRDB-4368

Epic CRDB-2454

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-schema-descriptorsRelating to SQL table/db descriptor handling.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions