View Single Post

   
  #4 (permalink)  
Old 02-28-2008, 10:48 AM
Paul Lautman
 
Posts: n/a
Default Re: Optimizing by replacing INTEGER with SET

ivanatora@gmail.com wrote:
> Thanks for the link! Ugh, I was sure I've been at that manual not a
> long time ago...
> So a change from INT to TINYINT would save 4-1=3 bytes. We have to do
> that for 3 columns so that make 9 bytes less for each row. If there
> are 120k rows that makes about 1MB less. Doesn't seem so impressive
> when there is 100MB database but is a good start
> Some optimization is always better than no optimization.
> I didn't understood what exactly INT(2) means? A number with 2 signs,
> taking 2 bytes or it can display a number with 2 signs maximum taking
> all 4 bytes as regular INT?


Here I have to refer you once again to that fount of knowledge "the manual".

In the same chapter, but an earlier section
http://dev.mysql.com/doc/refman/5.0/...-overview.html at the
very beginning it says:
A summary of the numeric data types follows. For additional information, see
Section 11.2, "Numeric Types". Storage requirements are given in Section
11.5, "Data Type Storage Requirements".
M indicates the maximum display width for integer types. The maximum legal
display width is 255. Display width is unrelated to the range of values a
type can contain, as described in Section 11.2, "Numeric Types". For
floating-point and fixed-point types, M is the total number of digits that
can be stored.

As to signs, the manual says in this very section that numeric data types
can be signed or unsigned and that this option merely affects the range of
numbers that can be stored rather than the amount of space they take up.

People may think me overly sarcastic when I point out that others should
read the manual. But most of the questions that I answer in this forum, I do
by searching the manual myself, just because those others are too lazy to do
it themselves (I'm sure this doesn't apply to you!)


Reply With Quote