On Mon, Jan 5, 2009 at 14:05, Frank Stanovcak <blindspot...@comcast.net> 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.br...@parasane.net || danbr...@php.net
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

Reply via email to