sql: stats collection doesn't get re-tried after a server shutdown #100482
Labels
A-sql-table-stats
Table statistics (and their automatic refresh).
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
T-sql-queries
SQL Queries Team
Discovered by @rytaft
Describe the problem
The automatic stats collection (used by SQL query planning) is triggered lazily when tables encounter mutations.
This lazy mechanism is based on an in-memory FIFO (a Go channel).
If a server gets shut down after a SQL mutation completes but before the mutation was popped from this FIFO (and thus before the job to compute the stats has been created), there will never be any re-computation.
This can result in bad query plans for tables that had a bunch of changes just before a node shuts down and then never change again.
To Reproduce
Issue a large number of mutations to a table and issue a server shutdown in the middle of these mutations.
Then restart the server and do not modify the table again. Notice that the stats remain out of date forever.
Expected behavior
Environment:
crdb v23.1 and
master
branchJira issue: CRDB-26459
The text was updated successfully, but these errors were encountered: