gpt4 book ai didi

sql - MySQL解释计划中 "Select tables optimized away"的含义

转载 作者:IT老高 更新时间:2023-10-28 12:58:08 31 4
gpt4 key购买 nike

MySQL Explain plan中Select tables optimization away是什么意思?

explain select count(comment_count) from wp_posts;

+----+-------------+---------------------------+-----------------------------+
| id | select_type | table,type,possible_keys, | Extra |
| | | key,key_len,ref,rows | |
+----+-------------+---------------------------+-----------------------------+
| 1 | SIMPLE | all NULLs | Select tables optimized away|
+----+-------------+---------------------------+-----------------------------+
1 row in set (0.00 sec)

注意:explain plan 为便于阅读而编辑输出。

最佳答案

来自 MySQL 文档:

The query contained only aggregate functions (MIN(), MAX()) that were all resolved using an index, or COUNT(*) for MyISAM, and no GROUP BY clause. The optimizer determined that only one row should be returned.

基本上这意味着您的查询使用 MySQL 直接可用的数据,并且查询将在恒定时间内运行。

关于sql - MySQL解释计划中 "Select tables optimized away"的含义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1992312/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com