Repository navigation
add ALTER TABLE COMPACT and the cold storage compaction and pin functions - #44
Merged
Merged
Conversation
emrberk
approved these changes
Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds parser, AST, serialization, formatter and autocomplete support for the cold storage compaction statement of QuestDB Enterprise, and adds its four new functions to the grammar lists. Both come from questdb/questdb-enterprise#1322, and are documented in questdb/documentation#651.
Changes
COMPACTandRESIDUALas keywords. Both stay non-reserved, as on the server, so they still work as unquoted table and column names: the server's own tests use a table namedresidual.BASEandCANCELalready existed.ALTER TABLE t COMPACT [BASE | RESIDUAL] PARTITION { LIST 'p' [, ...] | WHERE <expr> }andALTER TABLE t COMPACT CANCEL, followingEntSqlCompilerImpl.compileCompactPartition. The forms live in a dedicatedalterTableCompactActionrule, likealterTableForceAction.compactPartitionaction, with an optionalmodeofbaseorresidualand eitherpartitionsorwhere, and thecompactCancelaction, withtoSqlsupport for both.COMPACT ...on its own line in the formatter, like the otherALTER TABLEactions.cold_storage_compactions,cold_storage_pin_ownersandcold_storage_pinsto the table-valued functions, andcold_storage_release_pinsto the scalar functions, matching how the server registers them: three cursor functions and a boolean scalar.cst-types.d.ts. This also movesdoublePrecisionLiteralwithinPrimaryExpressionCstChildren, which the committed file had not caught up with.Testing
COMPACT BASEwithoutPARTITION, ofPARTITIONwithoutLISTorWHERE, and ofBASEandRESIDUALtogether.compact,baseandresidualremain valid identifiers, includingALTER TABLE residual COMPACT RESIDUAL ....ALTER TABLE tradesthroughCOMPACT,CANCEL,BASE,RESIDUAL,PARTITION,LISTandWHEREto the table's columns.FROM, withoutcold_storage_release_pins, andcold_storage_release_pinsin a select list.COMPACT BASE PARTITION WHERE ...andCOMPACT CANCEL.server-queries.json, taken fromDeltaCompactionRequestTest,DeltaMaintenanceTest,BaseCompactionTestandColdStoragePinAdminTestin questdb-enterprise, each checked for parsing, round trip, autocomplete and formatting.docs-queries.json.yarn test: 17,668 passed, 1 skipped (61 files)yarn typecheck: cleanyarn lint: cleanyarn build: ESM and CJS builds clean