Some settings are best scoped to tables or indexes rather than sessions or users/roles. Four current examples of settings that we would like to configure per-table:
- row-level GC TTL settings
- table statistics collection settings
- disallow_full_table_scans
- row-size guardrails
One could imagine these settings being included in CREATE TABLE and CREATE INDEX statements, modified with ALTER TABLE and ALTER INDEX, and viewed with SHOW CREATE TABLE.
As @mgartner pointed out in his comment linked above, Postgres already has syntax for storage parameters for tables and indexes which it uses for per-table autovacuum, among other settings. This could be a logical place to collect CockroachDB-specific table settings as well.
We already parse CREATE TABLE ... WITH and CREATE INDEX ... WITH syntax, but then discard most storage parameters and do not persist them (edit: except for a few, see @otan's comment below). We do not parse ALTER TABLE ... SET (...) nor show storage parameters in SHOW CREATE TABLE output. As @rafiss noted in #43299 we don't have real support for any of the Postgres storage parameters, much less CockroachDB-specific storage parameters.
So I think there are three work items here:
Edit: this overlaps with zone configs. (See discussion below.)
Jira issue: CRDB-8801
Some settings are best scoped to tables or indexes rather than sessions or users/roles. Four current examples of settings that we would like to configure per-table:
One could imagine these settings being included in
CREATE TABLEandCREATE INDEXstatements, modified withALTER TABLEandALTER INDEX, and viewed withSHOW CREATE TABLE.As @mgartner pointed out in his comment linked above, Postgres already has syntax for storage parameters for tables and indexes which it uses for per-table autovacuum, among other settings. This could be a logical place to collect CockroachDB-specific table settings as well.
We already parse
CREATE TABLE ... WITHandCREATE INDEX ... WITHsyntax, but then discard most storage parameters and do not persist them (edit: except for a few, see @otan's comment below). We do not parseALTER TABLE ... SET (...)nor show storage parameters inSHOW CREATE TABLEoutput. As @rafiss noted in #43299 we don't have real support for any of the Postgres storage parameters, much less CockroachDB-specific storage parameters.So I think there are three work items here:
ALTER TABLE ... SET (x = y)andALTER COLUMN ... SET (x = y)SHOW CREATE TABLEoutputEdit: this overlaps with zone configs. (See discussion below.)
Jira issue: CRDB-8801