forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
80761: stats: enable optimizer stats use on system tables for query planning r=msirek a=msirek Informs cockroachdb#80123 Previously, statistics could be collected on system tables, but their use in the optimizer for planning queries was disabled. This was inadequate because without stats, full table scan might be chosen by the optimizer for queries involving system tables in cases where index access is actually cheaper. Also, it is confusing that one could ANALYZE a system table, but the collected statistics would not be used when querying the table, as shown in the EXPLAIN output. To address this, this patch enables stats usage on all system tables except system.table_statistics and system.lease, as doing so may cause hangs. A new tenant-writable cluster setting is added, `sql.stats.system_tables.enabled`, which when true allows statistics on system tables to be used by the optimizer for costing and planning queries. The default value of this setting is `true`. Collection of statistics on `system.table_statistics` and `system.lease` has been disabled because it would be confusing to allow stats to be collected that would never be used by the optimizer. Release note: none Co-authored-by: Mark Sirek <[email protected]>
- Loading branch information
Showing
7 changed files
with
83 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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