Skip to content

sql: improve docs around partial statistics #20321

@rytaft

Description

@rytaft

I noticed that we don't talk about partial statistics much in our docs. This feature was enabled initially in 25.1, and should probably be discussed in this page where we talk about stats: https://www.cockroachlabs.com/docs/stable/cost-based-optimizer#table-statistics. Automatic collection of partial stats is controlled with cluster settings sql.stats.automatic_partial_collection.enabled, sql.stats.automatic_partial_collection.min_stale_rows, and sql.stats.automatic_partial_collection.fraction_stale_rows; and table settings sql_stats_automatic_partial_collection_enabled, sql_stats_automatic_partial_collection_min_stale_rows, and sql_stats_automatic_partial_collection_fraction_stale_rows. Use of partial stats in the optimizer is controlled by optimizer_use_merged_partial_statistics. Partial stats can also be manually collected by using CREATE STATISTICS .... USING EXTREMES (and in 25.4 we'll also support CREATE STATISTICS .... WHERE <predicate>).

Here are a couple of relevant PRs:
cockroachdb/cockroach#133988
cockroachdb/cockroach#142924
cockroachdb/cockroach#139925
cockroachdb/cockroach#127850

Jira issue: DOC-14809

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions