Re: Because you guys/gals/girls/women/insert pc term here are a smart lot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 5, 2009 at 14:05, Frank Stanovcak <blindspotpro@xxxxxxxxxxx> wrote:
> It's been a while since I've programed (VB was on version 4) I was wondering
> if any one could tell me what the diff is between char, varchar, and text in
> mysql.
> I know this isn't a mysql news group, but since I am using php for the
> interaction it seemed like the place to ask.  Thanks in advance, and have a
> great day!

    This doesn't explain it all, of course, but the most basic explanation is:

        CHAR(n)            Uses n bytes regardless of length of data
inserted[^1]
        VARCHAR(n)     Uses strlen+1 bytes[^2]
        TEXT                 Uses the highest amount of minimum bytes,
even for empty[^3]

    1: Quick SELECT/INSERT/UPDATE; requires (n) length; maxlength is
255; wastes space.
    2: Slow SELECT/INSERT/UPDATE; requires (n) length; maxlength is
65535; doesn't waste space.[^4]
    3: Moderate SELECT/INSERT/UPDATE; doesn't require (n); maxlength
is 65535; wastes space.[^5][^6]
    4: VARCHAR is further limited to the maximum row size of 65535.
    5: TEXT maxlength per column is 65535, but can have multiple
>=65535 columns on same row.
    6: TEXT includes four subcategories: TINYTEXT, TEXT, MEDIUMTEXT,
and LONGTEXT.

-- 
</Daniel P. Brown>
daniel.brown@xxxxxxxxxxxx || danbrown@xxxxxxx
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux