zoukankan      html  css  js  c++  java
  • Mysql数据库优化技术之索引篇

  • eq_ref

    One row will be read from this table for each combination of rows from the previous tables. Other than the const types, this is the best possible join type. It is used when all parts of an index are used by the join and the index is a PRIMARY KEY or UNIQUE index.

    eq_ref can be used for indexed columns that are compared using the = operator. The comparison value can be a constant or an expression that uses columns from tables that are read before this table.

    In the following examples, MySQL can use an eq_ref join to process ref_table:

    SELECT * FROM ref_table,other_table
    WHERE ref_table.key_column=other_table.column;
    SELECT * FROM ref_table,other_table
    WHERE ref_table.key_column_part1=other_table.column
    AND ref_table.key_column_part2=1;
  • ref

    All rows with matching index values will be read from this table for each combination of rows from the previous tables. ref is used if the join uses only a leftmost prefix of the key or if the key is not a PRIMARY KEY or UNIQUE index (in other words, if the join cannot select a single row based on the key value). If the key that is used matches only a few rows, this is a good join type.

    ref can be used for indexed columns that are compared using the = operator.

    In the following examples, MySQL can use a ref join to process ref_table:

    SELECT * FROM ref_table WHERE key_column=expr;
    SELECT * FROM ref_table,other_table
    WHERE ref_table.key_column=other_table.column;
    SELECT * FROM ref_table,other_table
    WHERE ref_table.key_column_part1=other_table.column
    AND ref_table.key_column_part2=1;
  • ref_or_null

查看全文
  • 相关阅读:
    你用过宏##粘贴函数,然后用函数指针查找执行吗?今天就给你说道说道
    c++nullptr(空指针常量)、constexpr(常量表达式)
    c++bind函数使用
    WordPress高亮代码插件enlighter自定义CSS
    终于有人把云计算、大数据和人工智能讲明白了!
    14. vue源码入口+项目结构分析
    13. Vue CLI脚手架
    12. Vue搭建本地服务
    11. webpack配置Vue
    10. vue之webpack打包原理和用法详解
  • 原文地址:https://www.cnblogs.com/cy163/p/1327620.html
  • Copyright © 2011-2022 走看看