如何理解mysql执行计划教程.pptx

  1. 1、本文档共29页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
如何理解mysql执行计划教程

如何理解Mysql执行计划; 我们已经能够用tcpdump+ percona tookit的pt-query-digest来获取mysql的 语句。在得到查询比较慢的sql时,我们需要知道查询慢在哪?;目录;Mysql的逻辑体系结构;查询的过程以及开销;查询性能低下的原因;SQL标准的执行流程(select);SQL标准的执行流程;sql中的join;nested loop join算法(对连接的优化);原理分析;explain的输出;explain的输出;type的类型(1);type的类型(2);type的类型(3);type的类型(4);type的类型(5);type的类型(6);Key相关;others;extra;extra;案例分析;Explain分析;; 补充: Temporary Tables In some cases, the server creates internal temporary tables while processing queries. Such a table can be held in memory and processed by the?MEMORY?storage engine, or stored on disk and processed by the?MyISAM?storage engine. The server may create a temporary table initially as an in-memory table, then convert it to an on-disk table if it becomes too large.? 临时表占用内存比较大时,超过?tmp_table_size and max_heap_table_size 的values值后会交换到磁盘 filesort 如果order by没有使用索引或者和groupby的字段不一样,执行计划中extra就会出现filesort,执行过程如下 1. Read the rows that match the?WHERE?clause. 2. For each row, record a tuple of values consisting of the sort key value and the columns referenced by the query. 3. When the sort buffer becomes full, sort the tuples by sort key value in memory and write it to a temporary file. 4. After merge-sorting the temporary file, retrieve the rows in sorted order, but read the required columns directly from the sorted tuples rather than by accessing the table a second time. 需要排序的行比较多的时,会出现sort buffer溢出,出现磁盘I/O,同时也消耗CPU 影响性能 ; 参考资料: 1. MySQL中Join算法实现原理分析 /art/200904/117947.htm 2. Mysql explain的输出 /persister/archive/2008/10/27/236813.html 3.图解sql的join /articles/3463.html? 4. How MySQL Uses Internal Temporary Tables /doc/refman/5.1/en/internal-temporary-tables.html 5. MySQL使用rand获取随机记录的性能优化问题 /iefreer/article/details6. MYSQL执行流程的简单探讨 /index.php/161.html 7.Filesort /doc/refman/5.6/en/order-by-optimization.html 8. emporary-tables /doc/refman/5.7/en/internal-temporary-tables.html ;THANK YOU

文档评论(0)

dajuhyy + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档