List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:May 29 2008 3:10pm
Subject:Re: Table Size
View as plain text  
In the last episode (May 29), living liquid | Christian Meisinger said:
> Olaf Stein wrote:
> > Because your int field always uses 4 bytes per record The varchar
> > uses length + 1 bytes
> 
> i know... still i'm confused.
> 
> the average length of the refurl varchar is 12 character, which means
> each row uses 12 + 3 bytes which is about 3 times the integer would
> use.
> 
> i've create two tables with only the refurl columns:
> 
> refurl varchar: Data  	29,326.1  	KiB
>                 Index 	4,084.0 	KiB
> 
> refurl integer: Data  	9,972.3  	KiB
>                 Index 	17,933.0 	KiB
> 
> so the data size is what i would expect.
> but i'm really surprised about the index size.

MySQL uses prefix compression on string indexes, so if your numbers are
mainly sequential, all but the last few characters will get omitted
from the index blocks.

http://dev.mysql.com/doc/refman/5.0/en/key-space.html


-- 
	Dan Nelson
	dnelson@stripped
Thread
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