Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql/stats: add variables to disable partial statistics merging and usage #95233

Closed
Tracked by #125950
michae2 opened this issue Jan 13, 2023 · 2 comments · Fixed by #98500 or #126948
Closed
Tracked by #125950

sql/stats: add variables to disable partial statistics merging and usage #95233

michae2 opened this issue Jan 13, 2023 · 2 comments · Fixed by #98500 or #126948
Assignees
Labels
A-sql-table-stats Table statistics (and their automatic refresh). branch-release-23.1 Used to mark GA and release blockers, technical advisories, and bugs for 23.1 C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-queries SQL Queries Team

Comments

@michae2
Copy link
Collaborator

michae2 commented Jan 13, 2023

Filing an issue for this TODO:

// TODO(faizaanmadhani): Wrap merging behind a boolean so
// that it can be turned off.

Now that we've introduced merging of partial statistics, we should add one or more variables to disable it if necessary.

Jira issue: CRDB-23413

Epic: CRDB-19449

@michae2 michae2 added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) A-sql-table-stats Table statistics (and their automatic refresh). T-sql-queries SQL Queries Team labels Jan 13, 2023
@blathers-crl

This comment was marked as resolved.

@michae2 michae2 added the branch-release-23.1 Used to mark GA and release blockers, technical advisories, and bugs for 23.1 label Mar 9, 2023
@mgartner mgartner self-assigned this Mar 13, 2023
@craig craig bot closed this as completed in 74f993a Mar 14, 2023
@mgartner mgartner moved this to Done in SQL Queries Jul 24, 2023
@DrewKimball
Copy link
Collaborator

Reopening because it looks like we'd still produce merged statistics for existing partial stats.

craig bot pushed a commit that referenced this issue Jul 11, 2024
126948: sql/opt: add session setting to disable merged partial stats use in opt r=Uzair5162 a=Uzair5162

Previously, any merged stats created from existing partial stats would always be used by the optimizer. Adds the
`optimizer_use_merged_partial_statistics` session setting, which can be used to disable merged stat usage in the optimizer. This is now disabled by default. Merged stats will still be created in the stats cache if partial stats exist, and the creation of partial stats can be controlled using the `enable_create_stats_using_extremes` session setting.

Fixes: #95233

See also: #125950

Release note (sql change): Added a session setting, `optimizer_use_merged_partial_statistics`, which can be set to true to enable usage of existing partial statistics merged with full statistics when optimizing a query, which is disabled by default.

Co-authored-by: Uzair Ahmad <[email protected]>
@craig craig bot closed this as completed in 22b384c Jul 11, 2024
@github-project-automation github-project-automation bot moved this from 24.2 Release to Done in SQL Queries Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-table-stats Table statistics (and their automatic refresh). branch-release-23.1 Used to mark GA and release blockers, technical advisories, and bugs for 23.1 C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-queries SQL Queries Team
Projects
Archived in project
4 participants