Skip to content

Conversation

rafiss
Copy link
Collaborator

@rafiss rafiss commented Oct 3, 2025

Backport 2/2 commits from #154711 on behalf of @rafiss.


This is needed in order to enforce the
sql.schema.approx_max_object_count cluster setting, which relies on optimizer table statistics to find the count.

Since the schemachanger uses the KV API to write to the descriptor table, we need to explicitly notify the stats refresher when it should compute new stats for the table.

informs: #148286
Release note: None

schematelemetry: update object count gauge using table stats

In order to support larger scales of object counts, we switch away from
using a full table scan on system.descriptors in order to update the
object count gauge.

Instead, we use table stats on system.descriptor now. The
schematelemetry job is updated so it notifies the stats refresher to
keep the stats up to date. Note that the stats refresher is also
notified with a partial count already.

Epic CRDB-48806
Release note: None


Release justification: resolve GA blocker

rafiss added 2 commits October 3, 2025 04:55
This is needed in order to enforce the
sql.schema.approx_max_object_count cluster setting, which relies on
optimizer table statistics to find the count.

Since the schemachanger uses the KV API to write to the descriptor
table, we need to explicitly notify the stats refresher when it should
compute new stats for the table.

Release note: None
In order to support larger scales of object counts, we switch away from
using a full table scan on system.descriptors in order to update the
object count gauge.

Instead, we use table stats on system.descriptor now. The
schematelemetry job is updated so it notifies the stats refresher to
keep the stats up to date. Note that the stats refresher is also
notified with a partial count already.

Release note: None
@rafiss rafiss requested a review from a team as a code owner October 3, 2025 16:55
@rafiss rafiss force-pushed the blathers/backport-release-25.4-154711 branch from f9eac5f to 4fd7db6 Compare October 3, 2025 16:55
@blathers-crl blathers-crl bot added blathers-backport This is a backport that Blathers created automatically. O-robot Originated from a bot. labels Oct 3, 2025
@blathers-crl blathers-crl bot requested a review from fqazi October 3, 2025 16:55
Copy link

blathers-crl bot commented Oct 3, 2025

Thanks for opening a backport.

Before merging, please confirm that the change does not break backwards compatibility and otherwise complies with the backport policy. Include a brief release justification in the PR description explaining why the backport is appropriate. All backports must be reviewed by the TL for the owning area. While the stricter LTS policy does not yet apply, please exercise judgment and consider gating non-critical changes behind a disabled-by-default feature flag when appropriate.

@blathers-crl blathers-crl bot added backport Label PR's that are backports to older release branches T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) labels Oct 3, 2025
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@fqazi fqazi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@fqazi reviewed 3 of 3 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

@rafiss rafiss merged commit 2c55282 into cockroachdb:release-25.4 Oct 7, 2025
14 of 15 checks passed
@rafiss rafiss deleted the blathers/backport-release-25.4-154711 branch October 7, 2025 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Label PR's that are backports to older release branches blathers-backport This is a backport that Blathers created automatically. O-robot Originated from a bot. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) target-release-25.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants