admin管理员组

文章数量:1599543

索引条件下推(index condition pushdown)

概念

​ 当没有icp时,存储引擎会运用索引定位到符合索引条件的行,将这些行发送给MySQL server去计算where 条件是否正确(重点是在server端计算)。当有icp时,如果where 条件的一部分可以通过索引来计算(意思就是索引中包含的信息足以计算这一部分where条件),那么MySQL Server就会将这部分索引条件下推到(index condition push)存储引擎(下推的意思可以看MySQL逻辑架构图)去计算(这里是在存储引擎端就把计算给做了,不需要在发送到server端),这样的话就可以返回尽量少的行给MySQL Server,也尽量少的让MySQL Server访问存储引擎层。
一言以蔽之,在一个用到索引的查询当中,所有二级索引里包含的信息,都可以通过“ICP机制”被用到“在二级索引中过滤尽可能多的行”。

Index Condition Pushdown (ICP) is an optimization for the case where MySQL retrieves rows from a table using an index. Without ICP, the storage engine traverses the index to locate rows in the base table and returns them to the MySQL server which evaluates the WHERE condition for the rows. With ICP enabled, and if parts of the

本文标签: 索引条件INDEXconditionPushdown