# Index of CHAR(32) vs BINARY(16) vs TEXT

**URL:** <https://forums.percona.com/t/index-of-char-32-vs-binary-16-vs-text/1001>\
**Category:** Other MySQL® Questions\
**Created:** [November 13, 2008, 8:21am UTC](https://forums.percona.com/t/index-of-char-32-vs-binary-16-vs-text/1001 "2008-11-13T08:21:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jedwood](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@jedwood](https://forums.percona.com/u/jedwood)\
**Post date:** [November 13, 2008, 8:21am UTC](https://forums.percona.com/t/index-of-char-32-vs-binary-16-vs-text/1001/1 "2008-11-13T08:21:29Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![MarkRose](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@MarkRose](https://forums.percona.com/u/MarkRose)\
**Post date:** [March 21, 2009, 8:00pm UTC](https://forums.percona.com/t/index-of-char-32-vs-binary-16-vs-text/1001/2 "2009-03-21T20:00:42Z")

</div>

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.
