cockroachdb / cockroachdb/cockroach

sql: scaffolding for ALTER TABLE ... DROP PARTITION

Open
#175,486 0 comments 0 reactions 1 assignee Claimed by @ZhouXing19 View on GitHub
C-enhancement T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

`DROP PARTITION` is being pursued as a faster bulk-deletion alternative to row-level TTL. Before it can land, the declarative schema changer needs to model table partitions as first-class elements. This issue tracks that groundwork, which is mergeable independently of `DROP PARTITION` itself.

Scope:

- Parser support for `ALTER TABLE ... ADD PARTITION` (`sql.y`, lexer, generated BNF).
- A new `TablePartition` element in `scpb`, with `screl` attributes and an `opgen` lifecycle.
- `scdecomp` support for decomposing existing named partitions on a table descriptor into `TablePartition` elements.
- `scbuild` implementation of `ALTER TABLE ... ADD PARTITION` on top of those elements.
- Logic tests and end-to-end declarative schema changer tests for the new statement.

Once partitions are modeled as elements, `ALTER TABLE ... DROP PARTITION` becomes an `scbuild` statement over the same foundation, tracked separately under the epic.

Epic: CRDB-65888

Jira issue: CRDB-68405

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.