List:General Discussion« Previous MessageNext Message »
From:Joerg Bruehe Date:May 29 2008 2:39pm
Subject:Re: Table Size
View as plain text  
Hi !

living liquid | Christian Meisinger wrote:
> i don't get it...
> why does the table below with `refurl` as varchar
> use less space then the table with `refurl` as integer????

"varchar" has the "var" for a reason: "varying length".
AFAIK, varchar fields take up just the space needed by their contents, 
while integer fields allow for the possible range.

But IMNSHO you would be following the wrong route if you decide your 
column types based on the space they need - you should go by your data 
type analysis.

For example: All those who defined a German postal code (1000 to 8999 
when they were introduced in the 1960s) field as "integer" suddenly got 
into trouble when a leading letter got introduced in 1990.
A postal code is no number (you cannot calculate on it, asking for "sum 
of all postal codes" or "average ..." makes no sense), it is a string 
(even when it was defined as a digit-only string).

 > [[ table definitions deleted ]]

So please do a proper analysis and ask yourself whether "digits only" 
really means "numeric value" or rather is a formatting rule.
Many identifying values like "article number", ISBN, ... are really 
strings and no numbers.


Joerg Bruehe,  MySQL Build Team,  joerg@stripped
Sun Microsystems GmbH,   Sonnenallee 1,   D-85551 Kirchheim-Heimstetten
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Haering     Muenchen: HRB161028

Table Sizeliving liquid | Christian Meisinger29 May
  • Re: Table SizeOlaf Stein29 May
    • Re: Table Sizeliving liquid | Christian Meisinger29 May
      • Re: Table SizeDan Nelson29 May
  • Re: Table SizeJoerg Bruehe29 May