请问Mysql中的primary key、unique、fulltext、index索引都在BTREE中存储是不是就是说以上的四种索引都是属于BTREE索引;还是说btree索引和另外的四种索引本身就是同一个层面上分类的索引,但是他们都存储在BTREE结构中?另外,hash索引是不是也是存储在btree结构中?望高手帮忙解答,不甚感激!

解决方案 »

  1.   

    请问Mysql中的primary key、unique、fulltext、index索引 这三种都是。
      

  2.   

    hash索引不会使用B树存储的。它有自己的索引结构。
      

  3.   

    请问ACMAIN_CHM,您所说的这三种都是指的是primary key、unique、index都是btree索引么?全文索引(fulltext)也是存储在B树结构中呵,他就不算btree索引么?谢谢!
      

  4.   

    你在哪儿看到fulltext是存储在B树结构当中啊?使用B树存储fulltext索引,可不是什么高效的方法。倒是使用倒排表比较有效。
      

  5.   

    MYSQL支持以下几种索引结构:
    B-TREE,B+-TREE,R-TREE,T-TREE,HASH.
      

  6.   

    并不是所有的引擎全支持上述索引结构。最后有一个<引擎,支持索引类型>的列表,这样才比较清晰。fulltext索引应该只在MyISAM引擎上才有吧(除非新版本有什么变化),用的是T-TREE?有没有熟悉的人介绍一下,呵呵。
      

  7.   

    btree索引和hash索引的区别
    http://blog.haohtml.com/index.php/archives/3311看看这样就明白了,呵
      

  8.   


    在《深入浅出MySQL——数据库开发、优化与管理维护 》中有讲到primary key、unique、index和fulltext索引都是存储在B树结构中的。
      

  9.   

    Most MySQL indexes (PRIMARY KEY, UNIQUE, INDEX, and FULLTEXT) are stored in B-trees. Exceptions are that indexes on spatial data types use R-trees, and that MEMORY tables also support hash indexes. 
      

  10.   

    mysql> create table t7(id int) type=myisam;
    Query OK, 0 rows affected, 1 warning (0.08 sec)mysql> create index idx_t7   using hash on t7(id);
    Query OK, 0 rows affected (0.11 sec)
    Records: 0  Duplicates: 0  Warnings: 0mysql> create index idx_t7_2   using btree on t7(id);
    Query OK, 0 rows affected (0.08 sec)
    Records: 0  Duplicates: 0  Warnings: 0
    不知道这个怎么解释
      

  11.   

    see http://dev.mysql.com/doc/refman/5.1/en/create-index.html
    Storage Engine Allowable Index Types 
    MyISAM BTREE, RTREE  
    InnoDB BTREE 
    MEMORY/HEAP  HASH, BTREE  
    NDB HASH, BTREE (see note in text) 
    mysql> show index from t7;
    +-------+------------+----------+--------------+-------------+-----------+------
    -------+----------+--------+------+------------+---------+
    | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardi
    nality | Sub_part | Packed | Null | Index_type | Comment |
    +-------+------------+----------+--------------+-------------+-----------+------
    -------+----------+--------+------+------------+---------+
    | t7    |          1 | idx_t7   |            1 | id          | A         |
      NULL |     NULL | NULL   | YES  | BTREE      |         |
    | t7    |          1 | idx_t7_2 |            1 | id          | A         |
      NULL |     NULL | NULL   | YES  | BTREE      |         |
    +-------+------------+----------+--------------+-------------+-----------+------
    -------+----------+--------+------+------------+---------+
    2 rows in set (0.00 sec)
      

  12.   

    3x. 
    看来using hash on t7(id)没什么效果。等同于btree.