-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql,sqlbase: maintain an index free-list on table descriptor #47981
Description
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