我有来自laravel的日志,它显示了查询执行的绑定时间和持续时间:
select * from `yg_product_detail` where `product_id` = '5551973459553' and `yg_product_detail`.`deleted_at` is null limit 1
Metadata
Bindings 0. 55197345953
Hints Use SELECT * only if you need all columns from table
LIMIT without ORDER BY causes non-deterministic results, depending on the query exection plan
Duration 26.8s如上所述,我的持续时间太长了,但我需要确保持续时间是来自mysql查询的实时时间吗?或者处理另一个查询之间的逻辑?
因为当我尝试对mysql运行这些查询时,它运行得很快。
谢谢
发布于 2019-09-27 13:34:11
绑定是插入到SQL查询中的值。右上角显示的执行时间是SQL查询执行所用的实际往返时间(即,将查询发送到DBMS和DBMS返回结果以及将结果解析为模型之间所经过的时间)。
如果您有一个像这样的雄辩的查询:
User::where('name', 'like', '%john%')
->orderBy('age')
->get();然后,它将被转换为准备好的SQL语句,如下所示:
select *
from `users`
where `name` like ?
order by `age`其中?被替换为绑定,在本例中为'%john%'。在本例中,绑定是您试图在查询中划掉但保留在查询解释表中的product_id。
https://stackoverflow.com/questions/58127899
复制相似问题