Matt
Matt

Reputation: 1

How best to store a 512 bit Data object in MySQL

I want to store a 512 bit data in mysql.

I'm wondering if it is better to store it as char(64) or 8 columns of bigint or something else?

My priority is to maximize the speed of comparison (I am ok to have slow updates, inserts, deletes in exchange for a faster comparison speed)

(I am aware simply storing it as char(64) will probably take the least development time, however although that's very important, it's currently ranked last in my set of priorities)

Upvotes: 0

Views: 185

Answers (2)

SingleNegationElimination
SingleNegationElimination

Reputation: 156158

you probably should not use char; character types apply encoding rules to the data, which make perfect sense when the data is text, but don't work at all for binary data. you should use binary

Upvotes: 0

Karoly Horvath
Karoly Horvath

Reputation: 96266

Prepare your downvotes, I've just read some Daily WTF, so this is going to be a bit crazy answer...

Store however you like (char, bigints..) but also add a hashed(md5? part of md5?) value, then after select, filter out false positives.

Upvotes: 1

Related Questions