[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: SQL question about performance...



Dirk wrote:
Hi!
(I've asked this before but my account seemed to be deleted for some
reason...)

I have the choice between VARCHAR(8) and INT(10) to store unsigned crc32
values in hex or as decimal integer.

Which one would result in more speed after putting an INDEX on it?
VARCHAR(8) or INT(10)?

...I use mySQL..
1. I don't think anyone minds, and those who have knowledge will try to help, but you would really probably be better off asking on a MySQL list.

2. You are storing, I think, 4 bytes of data, and considering storing it as a hex-encoded 8-character string. Why not use CHAR(8) rather then VARCHAR(8)? You won't be storing less then 8 characters, and CHAR(8) may be faster.

3. Why use INT(10) instead of just INT? That does not effect the storage, only pads the output.

4. The MySQL docs have lots of good optimization advice. Check http://dev.mysql.com/doc/ if you haven't. Start with the reference manual, it is very extensive.

5. My intuitive answer is, use INT. I'm not an expert on MySQL optimization, though.

Hopefully helpful,
Matthew



Reply to: