示例
示例
SHOW VARIABLES LIKE 'innodb_stats_persistent%';
SHOW VARIABLES LIKE 'innodb_stats_auto_recalc';
-- 表级声明
ALTER TABLE orders STATS_PERSISTENT=1, STATS_AUTO_RECALC=1,
STATS_SAMPLE_PAGES=64;| innodb_stats_persistent | 8.0 默认 ON:统计信息持久化到磁盘 |
|---|---|
| innodb_stats_auto_recalc | 变更行数超过一定比例时自动重新统计(异步) |
| STATS_SAMPLE_PAGES | 每索引采样页数,越大越准、代价越高 |