HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

When do hash indexes become reasonable?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
indexeshashreasonablewhenbecome

Problem

MySQL natively doesn't support hash indexes. So, making a pseudo hash column and creating an index on a hash column needs some thinking.

And it seems to be widely understood that if the text field is long then hashes are worth the overhead they require. But how long should text be to start thinking about hash?

If I intend to use 128bit hash then how many characters threshold would be a sufficient minimum for a text column?

Edit
Details listed in my another question maybe useful https://stackoverflow.com/questions/7403167/index-on-url-or-hashing-considering-ram

Solution

I'm not sure what are your reasons for wanting a hash index.

But if you are looking for indexing text/varchar columns then you can go with MyISAM/full-text or you can use something external like Sphinx or Lucene.

You can alternatively, create an additional column with a hashed version of another and as long as its 1000 bytes or less, then it can be indexed by MySQL.

I hope I have answered your question.

Context

StackExchange Database Administrators Q#5766, answer score: 3

Revisions (0)

No revisions yet.