MySQL: binary search without index

This is a flash of a genius:

http://linxtrix.com/2007/09/19/tricking-mysql-to-use-index-on-binary-search/

Problem: you can’t search case insensitive words. This trick will “do” it for you.

Make a test between this two ways:

SELECT * FROM test WHERE binary login = ‘SomeCaseSensitiveLogin’

is million times slower then

SELECT * FROM test WHERE login = ‘SomeCaseSensitiveLogin’ AND binary login = ‘SomeCaseSensitiveLogin’
avatar

About tompos

Hungary, Budapest
This entry was posted in IT. Bookmark the permalink.

Leave a Reply