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?).
It seems some kind of solution would be binary(16) null
for storage, unhex(md5(url))
for insertion/comparison, hex(url_hash)
for retrieval (not that it really needs retrieval, there will be unindexed url
column there anyway). Is this the best way?