Re: Because you guys/gals/girls/women/insert pc term here are a smart lot
| From: | Micah Gersten | Date: | Tue, 06 Jan 2009 16:24:26 +0000 |
| Subject: | Re: Because you guys/gals/girls/women/insert pc term here are a smart lot | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-285514@lists.php.net to get a copy of this message | ||
Nathan Rixham wrote:
> Richard Heyes wrote:
>>>> Also I could be missing
>>>> something, but I can't see the advantage in VARCHAR since space is not
>>>> really a concern these days.
>>> char is fixed length and padded. If you don't fill up the space, the
>>> db does it for you (even though it seems it's internal only).
>>>
>>> http://dev.mysql.com/doc/refman/5.0/en/char.html
>>>
>>> When CHAR values are stored, they are right-padded with spaces to the
>>> specified length. When CHAR values are retrieved, trailing spaces are
>>> removed.
>>
>> So where's the advantage of VARCHAR ?
>>
>
> storage size richard, as if you use char(100) then a string(4) will
> still use the space of string(100); whereas with varchar(100) it's
> only take up it's real space of string(4).
>
> it' may seem like a small amount of space but when you have 8
> char(255) columns in a table with 10 million rows you'd noticed the
> difference considerably.
Actually string(4) in a varchar(100) will take up 5 bytes, but that's
still better than 100.
Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com