zoukankan      html  css  js  c++  java
  • only for equality comparisons Hash Index Characteristics

    http://dev.mysql.com/doc/refman/5.7/en/index-btree-hash.html

    Hash Index Characteristics

    Hash indexes have somewhat different characteristics from those just discussed:

    • They are used only for equality comparisons that use the = or <=> operators (but are very fast). They are not used for comparison operators such as <that find a range of values. Systems that rely on this type of single-value lookup are known as key-value stores”; to use MySQL for such applications, use hash indexes wherever possible.

    • The optimizer cannot use a hash index to speed up ORDER BY operations. (This type of index cannot be used to search for the next entry in order.)

    • MySQL cannot determine approximately how many rows there are between two values (this is used by the range optimizer to decide which index to use). This may affect some queries if you change a MyISAM or InnoDB table to a hash-indexed MEMORY table.

    • Only whole keys can be used to search for a row. (With a B-tree index, any leftmost prefix of the key can be used to find rows.)

    app

    0-Hash索引限相等比较:= 或<=>,但比B-Tree快

    1-Hash索引对ORDER BY 无效

    https://dev.mysql.com/doc/refman/5.7/en/glossary.html

    B-tree

    A tree data structure that is popular for use in database indexes. The structure is kept sorted at all times, enabling fast lookup for exact matches (equals operator) and ranges (for example, greater than, less than, and BETWEEN operators). This type of index is available for most storage engines, such as InnoDB and MyISAM.

    Because B-tree nodes can have many children, a B-tree is not the same as a binary tree, which is limited to 2 children per node.

    Contrast with hash index, which is only available in the MEMORY storage engine. The MEMORY storage engine can also use B-tree indexes, and you should choose B-tree indexes for MEMORY tables if some queries use range operators.

    The use of the term B-tree is intended as a reference to the general class of index design. B-tree structures used by MySQL storage engines may be regarded as variants due to sophistications not present in a classic B-tree design. For related information, refer to the InnoDB Page Structure Fil Header section of the MySQL Internals Manual.

    See Also hash index.

    app

    0-Hash索引仅可用于MEMORY storage engine.

  • 相关阅读:
    方向-Vocabulary
    常见问题之Zego+Audio原生播放音频冲突
    synchronized类锁,方法锁,块级锁,一文看懂
    vim复制粘贴
    FastDFS文件服务器安装指南附安装包和自启动(看此篇就够了)
    springboot后端校验
    springboot打包启动时报mybatis的typeAlias类名找不到的错误
    给springboot增加XSS跨站脚本攻击防护功能
    docker cannot open directory .: Permission denied无权限问题
    docker学习笔记一篇就通系列(持续更新)
  • 原文地址:https://www.cnblogs.com/rsapaper/p/6234581.html
Copyright © 2011-2022 走看看