gpt4 book ai didi

sql - 将索引列放在 mysql WHERE 语句的左侧?

转载 作者:行者123 更新时间:2023-11-29 07:15:37 25 4
gpt4 key购买 nike

我很好奇,因为我在文档中看到了它。会写吗

select * from CONTACTS where id = ‘098’ and name like ‘Tom%’;

加速查询相对于

select * from CONTACTS where name like ‘Tom%’ and id = ‘098’;

第一个在左侧有一个索引列。它实际上会加快速度还是迷信?

使用 php 和 mysql

最佳答案

使用 explain 检查查询计划.它们应该完全相同。

关于sql - 将索引列放在 mysql WHERE 语句的左侧?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1399636/

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