Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Hash Index

Posted on 2008-10-23
4
Medium Priority
?
1,131 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:Umesh
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:
Umesh earned 375 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month9 days, 9 hours left to enroll

879 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