The Auto Query Plan Improvement feature collects and stores query plan statistics in a statistics cache when a query is executed in HeatWave. When a new query shares query execution plan nodes with previously executed queries, the statistics collected from previously executed queries are used instead of estimated statistics, which improves query execution plans, cost estimations, execution times, and memory efficiency.
Each entry in the cache corresponds to a query execution plan
node. A query execution plan may have nodes for table scans,
operations, and so on.
The statistics cache is an LRU structure. When cache capacity
is reached, the least recently used entries are evicted from
the cache as new entries are added. The number of entries
permitted in the statistics cache is 65536, which is enough to
store statistics for 4000 to 5000 unique queries of medium
complexity. The maximum number of statistics cache entries is
defined by the MySQL-managed