如果大型(ISH)MySQL表只有一个匹配结果,将查询限制到一个结果记录会提高性能吗?
例如
select * from people where name = "Re0sless" limit 1
如果只有一条记录有这个名字?如果name
是主键/设置为unique呢?这是否值得更新查询,或者yield 会很小?
如果大型(ISH)MySQL表只有一个匹配结果,将查询限制到一个结果记录会提高性能吗?
例如
select * from people where name = "Re0sless" limit 1
如果只有一条记录有这个名字?如果name
是主键/设置为unique呢?这是否值得更新查询,或者yield 会很小?
如果该列具有
a unique index: no,美元,不会更快.
a non-unique index: maybe,,因为它将阻止发送超出第一个匹配行(如果存在)之外的任何其他行
no index: sometimes