Solved

Hash Index

Posted on 2008-10-23
4
1,090 Views
Last Modified: 2012-08-13
I am trying to create a Hash Index on one of the columns of my table, but as I click 'Apply Changes', it gets automatically converted to BTREE index. Why?
I also want to know which index has good performance, a HASH index or a BTREE index, for an InnoDB table.
0
Comment
Question by:rpkhare
  • 2
  • 2
4 Comments
 
LVL 26

Expert Comment

by:ushastry
ID: 22793926
Which engine are you using for that table?  is it InnoDB/MyISAM ?

Some storage engines allow you to specify an index type when creating an index. The allowable index type values supported by different storage engines are shown in the following table. Where multiple index types are listed, the first one is the default when no index type specifier is given.

Storage                               Engine Allowable Index Types
MyISAM                                     BTREE, RTREE  
InnoDB                                      BTREE
MEMORY/HEAP                        HASH, BTREE  
NDB                                      HASH, BTREE (see note in text)



For your second query...

http://dev.mysql.com/doc/refman/5.1/en/innodb-adaptive-hash.html
0
 
LVL 8

Author Comment

by:rpkhare
ID: 22798332
InnoDB.
0
 
LVL 26

Accepted Solution

by:
ushastry earned 125 total points
ID: 22798532
InnoDB's default index type is "BTREE"..

InnoDB has a mechanism that monitors index searches made to the indexes defined for a table. If InnoDB notices that queries could benefit from building a hash index, it does so automatically.

Note that the hash index is always built based on an existing B-tree index on the table. InnoDB can build a hash index on a prefix of any length of the key defined for the B-tree, depending on the pattern of searches that InnoDB observes for the B-tree index
0
 
LVL 8

Author Closing Comment

by:rpkhare
ID: 31510076
Thanks
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
Foreword This article was written many years ago, in the days when PHP supported the MySQL extension (http://php.net/manual/en/function.mysql-connect.php).  Today (http://php.net/manual/en/migration70.removed-exts-sapis.php) you would not use MySQL…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question