In cockroachdb when I explain my query i see this
root@:26257/management_console_production> explain select * from clusters;
info
-----------------------------------------------------------------------------
distribution: local
vectorized: true
• scan
estimated row count: 40 (100% of the table; stats collected 8 days ago)
table: clusters@clusters_pkey
spans: FULL SCAN
(7 rows)
Time: 2ms total (execution 2ms / network 0ms)
It shows above that stats were collected 8 days ago, how do i refresh the table statistics?
In CRDB the cost based optimizer uses these statistics to make better query plans. Table statistics are refreshed automatically based on usage patterns and some cluster settings
You can manually update table statistics using
CREATE STATISTICSorANALYZESee more about how table statistics works here