Best way to have unique key over 500M varchar(255) records in mysql/innodb?
Posted
by taw
on Stack Overflow
See other posts from Stack Overflow
or by taw
Published on 2010-03-12T22:55:55Z
Indexed on
2010/03/12
22:57 UTC
Read the original article
Hit count: 166
mysql
I have url column with unique key over it - but its performance on updates is absolutely atrocious. I suspect that's because the index doesn't all fit in memory.
So I was thinking, how about adding a column of md5(url) with 16 bytes of binary data and unique-keying that instead.
What would be the best datatype for that? I'd love to be able to just see 32-character hex hash, while mysql would convert it to/from 16 binary bytes and index that, as programs using the database might have some troubles with arbitrary binary data that I'd rather avoid if possible (also I'm a bit afraid that mysql might get some strange ideas about character sets and for example overalocating storage for that by 3:1 because it thinks it might need utf8, how do I avoid that for cure?).
© Stack Overflow or respective owner