← Back to team overview

maria-developers team mailing list archive

Re: hash + like

 

Hi, Roberto!

On Oct 23, Roberto Spadim wrote:
> Hi guys, how could i optimize a hash index using like?
> 
> i was thinking about something like a index over first left bytes using
> hash, example:
> field LIKE "abc%"
> 
> create index hash_index( field(3) ) using hash
> 
> any idea if this could be possible? this could boost some queries here that
> i'm using btree
> 
> today i'm using the LIKE, but i'm considering a virtual column + a index
> over virtual column + a ( AND virtual_column='abc')

With the virtual column it'll work, but if you simply create an index
like above and will use LIKE 'abc%', then it probably won't use the
index.

And don't forget that not all storage engines support HASH indexes.
Basically, in 5.5 only MEMORY tables do.

Regards,
Sergei


References