List:General Discussion« Previous MessageNext Message »
From:Olaf Stein Date:May 29 2008 2:38pm
Subject:Re: Table Size
View as plain text  
Because your int field always uses 4 bytes per record
The varchar uses length + 1 bytes


Olaf


On 5/29/08 10:18 AM, "living liquid | Christian Meisinger"
<c.meisinger@stripped> 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????
> 
> 
> ~90MB ->
> CREATE TABLE IF NOT EXISTS `variationStatistic::4` (
>    `id` bigint(20) NOT NULL AUTO_INCREMENT,
>    `week_from` int(11) NOT NULL,
>    `week_till` int(11) NOT NULL,
>    `year` int(11) NOT NULL,
>    `from` int(11) NOT NULL,
>    `till` int(11) NOT NULL,
>    `refurl` varchar(2500) NOT NULL,
>    `tid` int(11) NOT NULL,
>    `cid` int(11) NOT NULL,
>    `aid` bigint(20) NOT NULL,
>    `ccb` int(11) NOT NULL,
>    `variation` varchar(50) NOT NULL,
>    `country` char(2) NOT NULL,
>    `siteid` int(11) NOT NULL,
>    `search_engine`
> enum('google','yahoo','altavista','ask','msn','lycos','search.live') NOT NULL,
>    `search_value_id` int(11) NOT NULL,
>    `views` int(11) NOT NULL,
>    `sales` int(11) NOT NULL,
>    `amount` bigint(20) NOT NULL,
>    `amountPeriod` bigint(20) NOT NULL,
>    PRIMARY KEY (`id`),
>    KEY `refurl` (`refurl`(1000)),
>    KEY `all` (`variation`,`country`,`cid`,`tid`,`ccb`,`aid`),
>    KEY `vwfwty` (`variation`,`week_from`,`week_till`,`year`),
>    KEY `vartill` (`variation`,`till`)
> ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1460161 ;
> 
> 
> ~120MB ->
> CREATE TABLE IF NOT EXISTS `variationStatistic::4` (
>    `id` bigint(20) NOT NULL AUTO_INCREMENT,
>    `week_from` int(11) NOT NULL,
>    `week_till` int(11) NOT NULL,
>    `year` int(11) NOT NULL,
>    `from` int(11) NOT NULL,
>    `till` int(11) NOT NULL,
>    `refurl` int(11) NOT NULL,
>    `tid` int(11) NOT NULL,
>    `cid` int(11) NOT NULL,
>    `aid` bigint(20) NOT NULL,
>    `ccb` int(11) NOT NULL,
>    `variation` varchar(50) NOT NULL,
>    `country` char(2) NOT NULL,
>    `siteid` int(11) NOT NULL,
>    `search_engine`
> enum('google','yahoo','altavista','ask','msn','lycos','search.live') NOT NULL,
>    `search_value_id` int(11) NOT NULL,
>    `views` int(11) NOT NULL,
>    `sales` int(11) NOT NULL,
>    `amount` bigint(20) NOT NULL,
>    `amountPeriod` bigint(20) NOT NULL,
>    PRIMARY KEY (`id`),
>    KEY `refurl` (`refurl`(1000)),
>    KEY `all` (`variation`,`country`,`cid`,`tid`,`ccb`,`aid`),
>    KEY `vwfwty` (`variation`,`week_from`,`week_till`,`year`),
>    KEY `vartill` (`variation`,`till`)
> ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1460161 ;
> 

----------------------------------------- Confidentiality Notice:
The following mail message, including any attachments, is for the
sole use of the intended recipient(s) and may contain confidential
and privileged information. The recipient is responsible to
maintain the confidentiality of this information and to use the
information only for authorized purposes. If you are not the
intended recipient (or authorized to receive information for the
intended recipient), you are hereby notified that any review, use,
disclosure, distribution, copying, printing, or action taken in
reliance on the contents of this e-mail is strictly prohibited. If
you have received this communication in error, please notify us
immediately by reply e-mail and destroy all copies of the original
message. Thank you.
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