release-25.4: sql: update stats for descriptor table #154756
Merged
+101
−63
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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