美文网首页
MySql 优化

MySql 优化

作者: littleDinosaur | 来源:发表于2017-04-20 20:53 被阅读0次

To make a slow SELECT ... WHERE
query faster, the first thing to check is whether you can add an index. Set up indexes on columns used in the WHERE
clause, to speed up evaluation, filtering, and the final retrieval of results. To avoid wasted disk space, construct a small set of indexes that speed up many related queries used in your application.

优化select .. where 的查询语句 ,第一步应该检查是否添加了索引。在 where 从句的列中添加索引可以令求值,过滤,和对最终结果的检索加速。为了避免磁盘的浪费,构造一小个索引的集合 可以使你应用中相关查询加速。

  • 最左最左匹配
    If the table has a multiple-column index, any leftmost prefix of the index can be used by the optimizer to look up rows. For example, if you have a three-column index on(col1, col2, col3), you have indexed search capabilities on(col1),(col1, col2), and(col1, col2, col3). For more information, see Section 9.3.5, “Multiple-Column Indexes”.

相关文章

网友评论

      本文标题:MySql 优化

      本文链接:https://www.haomeiwen.com/subject/jpxrzttx.html