Hi, nihal!
On Jan 25, nihal dindar wrote:
> Hi all,
>
> Is it possible to implement a hash index on MyISAM tables? Or is there
> any open src implementation?
Yes and no.
MyISAM supports, in a sense, hash indexes, in a sense :)
"Supports, in a sense" because MyISAM does support them, look for the
work "uniques" in the myisam subdirectory. But there is no way you can
access this functionality from SQL, you cannot create indexes of this
kind, UNIQUE index that you create in table is not that.
"Hash indexes, in a sense" because there is no hash table - it's a btree
of hashed key values. And it's still O(long N), not O(1). Unlike a
normal index it does not support ranges or prefix searches. But it can
index very long keys, for example, in can maintain the unique constraint
over a BLOB column. That's why they were implemented in the first
place - to ensure uniqueness, MySQL uses them sometimes for SELECT
DISTINCT.
Anyway, you cannot create these indexes manually in a table, this
functionality is not implemented.
Regards,
Sergei