Home » Performance » MySQL » Index of CHAR(32) vs BINARY(16) vs TEXT
Index of CHAR(32) vs BINARY(16) vs TEXT [message #3715] Thu, 13 November 2008 08:51 Go to next message
jedwood  is currently offline jedwood
Messages: 1
Registered: November 2008
Junior Member
Things I don't care about:

- storage space (rows in the thousands, not millions)
- security (this is not a password)

Things I do care about:

- speed

So, I have a variable length bit of text that can be as small as 3 characters but will never be longer than what the TEXT type allows. And I need to make a comparison against this field. My idea is to md5 it in PHP and store it as either CHAR(32) or BINARY(16) (if I use the raw_output = TRUE parameter). But I could also skip the hash step and just store it in TEXT, though that seems like it'd be a much poorer index than one of the first two options.

Any thoughts?

Thanks!
Re: Index of CHAR(32) vs BINARY(16) vs TEXT [message #4142 is a reply to message #3715 ] Sat, 21 March 2009 21:30 Go to previous message
MarkRose  is currently offline MarkRose
Messages: 94
Registered: January 2008
Member
TEXT will be bad. CHAR is better. BINARY is better if row length is an issue, but unreadable when debugging. I'd go CHAR.

Put an index on the field, too.
Previous Topic:Query runs very slowly, however all indexes are used
Next Topic:performance issue
Goto Forum:
  


Current Time: Thu Jul 9 22:29:42 EDT 2009

Total time taken to generate the page: 0.03113 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 2.7.7.
Copyright ©2001-2007 FUD Forum Bulletin Board Software

MySQL is a trademark of Sun Microsystems.
InnoDB is a trademark of Oracle Corp.

Percona Performance Forums are a service of Percona, Inc.
Not affiliated with Sun Microsystems or Oracle Corp.