国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

MySQL Index Condition Pushdow!n(ICP)性能優化方法實例

2019-11-02 15:36:49
字體:
來源:轉載
供稿:網友

   這篇文章主要介紹了MySQL Index Condition Pushdown(ICP)性能優化方法實例,本文講解了概念介紹、原理、實踐案例、案例分析、ICP的使用限制等內容,需要的朋友可以參考下

  一 概念介紹

  Index Condition Pushdown (ICP)是MySQL 5.6 版本中的新特性,是一種在存儲引擎層使用索引過濾數據的一種優化方式。

  a 當關閉ICP時,index 僅僅是data access 的一種訪問方式,存儲引擎通過索引回表獲取的數據會傳遞到MySQL Server 層進行where條件過濾。

  b 當打開ICP時,如果部分where條件能使用索引中的字段,MySQL Server 會把這部分下推到引擎層,可以利用index過濾的where條件在存儲引擎層進行數據過濾,而非將所有通過index access的結果傳遞到MySQL server層進行where過濾.

  優化效果:ICP能減少引擎層訪問基表的次數和MySQL Server 訪問存儲引擎的次數,減少io次數,提高查詢語句性能。

  二 原理

  Index Condition Pushdown is not used:

  1 Get the next row, first by reading the index tuple, and then by using the index tuple to locate and read the full table row.

  2 Test the part of the WHERE condition that applies to this table. Accept or reject the row based on the test result.

  Index Condition Pushdown is used

  1 Get the next row s index tuple (but not the full table row).

  2 Test the part of the WHERE condition that applies to th

思雨電影網[www.aikan.tv/special/siyudianyingwang/]
is table and can be checked using only index columns.

  If the condition is not satisfied, proceed to the index tuple for the next row.

  3 If the condition is satisfied, use the index tuple to locate and read the full table row.

  4 est the remaining part of the WHERE condition that applies to this table. Accept or reject the row based on the test result.

  三 實踐案例

  a 環境準備

  數據庫版本 5.6.16

  關閉緩存

  代碼如下:

  set query_cache_size=0;

  set query_cache_type=OFF;

  測試數據下載地址

  b 當開啟ICP時

  代碼如下:

  mysql> SET profiling = 1;

  Query OK, 0 rows affected, 1 warning (0.00 sec)

  mysql> select * from employees where first_name='Anneke' and last_name like '%sig' ;

  +--------+------------+------------+-----------+--------+------------+

  | emp_no | birth_date | first_name | last_name | gender | hire_date |

  +--------+------------+------------+-----------+--------+------------+

  | 10006 | 1953-04-20 | Anneke | Preusig | F | 1989-06-02 |

  +--------+------------+------------+-----------+--------+------------+

  1 row in set (0.00 sec)

  mysql> show profiles;

  +----------+------------+--------------------------------------------------------------------------------+

  | Query_ID | Duration | Query |

  +----------+------------+--------------------------------------------------------------------------------+

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 伊金霍洛旗| 沛县| 馆陶县| 南京市| 林甸县| 余庆县| 金华市| 紫阳县| 通辽市| 南川市| 新津县| 林周县| 察雅县| 沅陵县| 安西县| 漳浦县| 达州市| 清涧县| 建阳市| 清水河县| 行唐县| 馆陶县| 清河县| 沾益县| 宜阳县| 绥江县| 阳西县| 丘北县| 北川| 高阳县| 土默特左旗| 安多县| 苍溪县| 鲁甸县| 霍林郭勒市| 逊克县| 景谷| 泾阳县| 恩施市| 湖南省| 旬邑县|