假如必要删除已经建设的直方图,用DROP HISTOGRAM就可以实现:
- mysql> ANALYZE TABLE payment DROP HISTOGRAM ON payment_date;
- +----------------+-----------+----------+---------------------------------------------------------+
- | Table | Op | Msg_type | Msg_text |
- +----------------+-----------+----------+---------------------------------------------------------+
- | sakila.payment | histogram | status | Histogram statistics removed for column 'payment_date'. |
- +----------------+-----------+----------+---------------------------------------------------------+
UPDATE HISTOGRAM可以一次性为多个列建设直方图。假如呼吁中间写错,ANALYZE TABLE如故会起浸染。好比,你指定了三列,但第二列不存在。MySQL如故会为第一列和第三列建设直方图。
- mysql> ANALYZE TABLE customer UPDATE HISTOGRAM ON c_birth_day, c_foobar, c_birth_month WITH 32 BUCKETS;
- +----------------+-----------+----------+----------------------------------------------------------+
- | Table | Op | Msg_type | Msg_text |
- +----------------+-----------+----------+----------------------------------------------------------+
- | tpcds.customer | histogram | status | Histogram statistics created for column 'c_birth_day'. |
- | tpcds.customer | histogram | status | Histogram statistics created for column 'c_birth_month'. |
- | tpcds.customer | histogram | Error | The column 'c_foobar' does not exist. |
- +----------------+-----------+----------+----------------------------------------------------------+
- 3 rows in set (0.15 sec)
数据库内部产生了什么
当你读过MySQL手册,你也许已经留意到新的体系变量histogram_generation_max_mem_size。当用户成立统计直方图,这个值是用来节制约莫几多内存能应承被行使。那么,为什么要节制这个呢?
(编辑:湖南网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|