cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
30.18k stars 3.82k forks source link

*: rename SQL Stats #80279

Open Azhng opened 2 years ago

Azhng commented 2 years ago

Previously, SQL Stats refer to statement / transaction statistics. This is often confused with table statistics, which are used by the optimizer to better plan queries.

We need a better name to avoid terminology confusion.

Jira issue: CRDB-15788

mgartner commented 2 years ago

Can we make a thorough list of all the places that the statement / transcation statistics are named with some form of stats or statistics? A rough brainstorm:

I think we should prioritize user-facing names like settings and job types/descriptions. Package names aren't see by a customer and will cause less confusion. They're also easier to switch in the future, whereas things like setting names are not.

rafiss commented 2 years ago

There's also the crdb_internal.reset_sql_stats builtin

mgartner commented 2 years ago

The cluster settings for SQL activity stats also use the same namespace, sql.stats, as table statistics cluster settings:

Table statistics:

Setting Type Default Description
sql.stats.automatic_collection.enabled boolean true automatic statistics collection mode
sql.stats.automatic_collection.fraction_stale_rows float 0.2 target fraction of stale rows per table that will trigger a statistics refresh
sql.stats.automatic_collection.min_stale_rows integer 500 target minimum number of stale rows per table that will trigger a statistics refresh
sql.stats.histogram_collection.enabled boolean true histogram collection mode
sql.stats.multi_column_collection.enabled boolean true multi-column statistics collection mode
sql.stats.post_events.enabled boolean false if set, an event is logged for every CREATE STATISTICS job

SQL Activity Statistics:

Setting Type Default Description
sql.stats.cleanup.recurrence string @hourly cron-tab recurrence for SQL Stats cleanup job
sql.stats.flush.enabled boolean true if set, SQL execution statistics are periodically flushed to disk
sql.stats.flush.interval duration 10m0s the interval at which SQL execution statistics are flushed to disk, this value must be less than or equal to sql.stats.aggregation.interval
sql.stats.persisted_rows.max integer 1000000 maximum number of rows of statement and transaction statistics that will be persisted in the system tables
sql.stats.response.max integer 20000 the maximum number of statements and transaction stats returned in a CombinedStatements request

We'll have to figure out a migration plan for the settings that causes as little annoyance for customers as possible.

More immediately, I think we should make the descriptions of these settings more clear in our documentation.

mgartner commented 2 years ago

This also affects metric names: https://github.com/cockroachdb/cockroach/blob/2fdc0a62df08829dd96901fffb5fb1fbb0b0997d/pkg/sql/exec_util.go#L1031-L1084

maryliag commented 1 year ago

No longer a priority

michae2 commented 12 months ago

Reopening because there was confusion from a customer about this.

blathers-crl[bot] commented 4 days ago

This issue has multiple T-eam labels. Please make sure it only has one, or else issue synchronization will not work correctly.

:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.