-
Notifications
You must be signed in to change notification settings - Fork 4.1k
'SHOW TABLES WITH settingName' and 'SHOW CLUSTER SETTINGS FOR TABLE' #78395
Description
Is your feature request related to a problem? Please describe.
- PR#78110 adds support for setting certain cluster setting overrides for individual tables. There is currently no way for a user or DBA to discover which tables in the system have a given setting set, if they wish to unset it for all tables, without issuing a
SHOW CREATE TABLEstatement on every table in the system. Here is an example query which could find these tables, but it references crdb_internal, which is generally not customer-visible:
SELECT
tbl.database_name || '.' || tbl.schema_name || '.' || tbl.name
FROM
crdb_internal.tables AS tbl
INNER JOIN system.descriptor AS d ON d.id = tbl.table_id
WHERE
tbl.database_name IS NOT NULL
AND tbl.drop_time IS NULL
AND
crdb_internal.pb_to_json('cockroach.sql.sqlbase.Descriptor',
d.descriptor, false)->'table'->'clusterSettingsForTable'
->> 'sqlStatsAutomaticCollectionEnabled' = 'true';
?column?
--------------------
defaultdb.mws.t1
- Currently, table settings (storage parameters) are displayed in the
SHOW CREATE TABLEoutput. However, it would be nice to have a new statement which displays just the current cluster settings for the table, one per line, instead of a denseWITHclause which prints all settings on one line and has other storage parameters mixed in. If no cluster settings are specified at the table level, that could quickly be determined by empty output.
Describe the solution you'd like
-
Add a new statement, such as
SHOW TABLES [IN _schemaName_] WITH "_settingName_" (SET | UNSET);which would list all tables (or all tables in a given schema) having a given table setting, such assql.stats.automatic_collection.enabledset to a value, or not set (via theSETorUNSET option). This would not be specific to table-level cluster settings added by [PR#78110](https://github.com/cockroachdb/cockroach/pull/78110), but apply to any table setting added byCREATE TABLE ... WITHorALTER TABLE ... SET`. Optionally, a statement to list all tables with any storage parameter set could be supported. A variant of this could list all tables with any cluster setting set. -
A new statement such as
SHOW CLUSTER SETTINGS FOR TABLE _tableName_, and possibly aSHOW SESSION SETTINGS FOR TABLE _tableName_statement could be added to list table-level cluster settings and table-level session settings (currently table-level session settings are not supported). Optionally aSHOW SETTINGS FOR TABLE _tableName_statement could be added which would list both cluster and session settings in effect for the table.
Describe alternatives you've considered
None
Additional context
None
Jira issue: CRDB-14104
Metadata
Metadata
Assignees
Labels
Type
Projects
Status