mysql min函数优化
select min(id) from table where noindexfield = 'abc'
当where 条件未有索引,求的最小字段 又是主键的时候,可采用
select id from table where noindexfield = 'abc' limit 1
优化方案出自 高性能mysql
当在没有索引的条件下寻找最小值,特别是针对主键字段时,使用LIMIT 1代替MIN函数可以有效提升查询效率。此优化策略源自《高性能MySQL》一书。
mysql min函数优化
select min(id) from table where noindexfield = 'abc'
当where 条件未有索引,求的最小字段 又是主键的时候,可采用
select id from table where noindexfield = 'abc' limit 1
优化方案出自 高性能mysql
193

被折叠的 条评论
为什么被折叠?