作家
登录

优化SQL语句的一般步骤

作者: 来源: 2017-08-31 16:11:21 阅读 我要评论

  •  select_type: SIMPLE 
  •        table: film 
  •   partitions: NULL 
  •         type: index 
  • possible_keys: NULL 
  •          key: idx_title 
  •      key_len: 767 
  •          ref: NULL 
  •         rows: 1000 
  •     filtered: 100.00 
  •        Extra: Using index 
  • 1 row in set, 1 warning (0.00 sec) 
  • 3. type=range,索引范围扫描,常见于<、<=、>、>=、between等操作:

    1. mysql> explain select * from payment where customer_id >= 300 and customer_id <= 350 \G   
    2.  
    3. *************************** 1. row *************************** 
    4.           id: 1 
    5.  select_type: SIMPLE 
    6.        table: payment 
    7.   partitions: NULL 
    8.         type: range 
    9. possible_keys: idx_fk_customer_id 
    10.          key: idx_fk_customer_id 
    11.      key_len: 2 
    12.          ref: NULL 
    13.         rows: 1350 
    14.     filtered: 100.00 
    15.        Extra: Using index condition 
    16. 1 row in set, 1 warning (0.07 sec) 
    1. mysql> explain select * from payment where customer_id = 350 \G   
    2. *************************** 1. row *************************** 
    3.           id: 1 
    4.  select_type: SIMPLE 
    5.        table: payment 
    6.   partitions: NULL 
    7.         type: ref 
    8. possible_keys: idx_fk_customer_id 
    9.          key: idx_fk_customer_id 
    10.      key_len: 2 

    11.   推荐阅读

        远胜微软谷歌等翻译器 | 基于神经网络和超级计算机的DeepL Translator

      Microsoft Translator是微软旗下的翻译对象,痊愈客岁成功切换至神经网路。当时,微软表示比拟较今朝行业内主流的统计机械翻译(SMT)技巧,神经收集架构可以或许大年夜幅晋升翻译质量。德>>>详细阅读


      本文标题:优化SQL语句的一般步骤

      地址:http://www.17bianji.com/lsqh/37055.html

    关键词: 探索发现

    乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

    网友点评
    自媒体专栏

    评论

    热度

    精彩导读
    栏目ID=71的表不存在(操作类型=0)