gpt4 book ai didi

mysql - 如何解释这个警告

转载 作者:行者123 更新时间:2023-11-28 23:12:48 25 4
gpt4 key购买 nike

我正在使用 MySQL 5.7.19,在我运行 explain 之后在以下脚本中:

explain select a.seller_id AS seller_id, 
a.seller_name AS seller_name,
b.user_name AS user_name,
c.state AS state
from a
join b
join c
where((b.seller_name = a.seller_name) and
(c.user_id = 17) and(b.user_id = 17) and
(a.gmt_create between ((now() - interval 600 minute)) and ((now() + interval 600 minute))))
order by a.gmt_create;

这是我收到的警告信息:

enter image description here

将其转化为人类可读的形式:

select a.seller_id AS seller_id, 
a.seller_name AS seller_name,
b.user_name AS user_name,
c.state AS state
from a
join b
join c
where((b.seller_name = a.seller_name) and
(c.user_id = 17) and(b.user_id = 17) and
(a.gmt_create between <cache>((now() - interval 600 minute)) and <cache>((now() + interval 600 minute))))
order by a.gmt_create;

<cache> 是什么意思?标签是什么意思??

最佳答案

引用manual :

  • <cache>

The expression (such as a scalar subquery) is executed once and the resulting value is saved in memory for later use. For results consisting of multiple values, a temporary table may be created and you will see <temporary table> instead.

这意味着,您计算的 now() - interval 600 minute仅执行一次,结果用于您的 where 子句检查的每一行。

关于mysql - 如何解释这个警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45184472/

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