loose index scan 优化distinct
上篇中我们提到用伪loose index scan来优化max/min,这一篇我们将用伪loose index scan来优化distinct:
有这样的一个需求:select count(distinct nick) from user_access_xx_xx;
这条sql用于统计用[……]
上篇中我们提到用伪loose index scan来优化max/min,这一篇我们将用伪loose index scan来优化distinct:
有这样的一个需求:select count(distinct nick) from user_access_xx_xx;
这条sql用于统计用[……]
今天有点激动,因为在5.6的官方文档中看到Index Condition Pushdown Optimization,简称ICP,这意味着什么,意味着mysql的优化器能够像oracle的优化器那样对索引列进行过滤,而不是像以前版本中只能使用前缀索引来过滤满足查询条件的行;
为了说明优化器是怎[……]
在5.1.46中优化器在对primary key的选择上做了一点改动:
Performance: While looking for the shortest index for a covering index scan, the optimizer did not consider the[……]
通常应用需要对表中的数据进行翻页,如果数据量很大,往往会带来性能上的问题:
[……]
优化前:
select count(t.id)
from test t
where t.status = 1
and t.id not in (select distinct a.app_id
from test2 a
[……]
今天开发给了一条sql,查询表中最近更新的一条记录:
select id,
type,
object_id,
nick,
isv_id,
next_auditor_role,
[……]