Best practices for efficiently storing md5 hashes in mysql

Eugene Yarmash picture Eugene Yarmash · Feb 24, 2010 · Viewed 18.6k times · Source

Possible field types:

BINARY(16)
CHAR(32)
BIGINT + BIGINT

How do I decide which one to use?

Answer

Josh Davis picture Josh Davis · Feb 24, 2010

If the column is indexed and you know what you're doing, BINARY(16) for performance reasons.

Otherwise, CHAR(32) is fine. Make sure the column uses the ascii charset though. (ascii_bin for example)