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

From: Date: Mon, 05 Jan 2009 19:21:39 +0000
Subject: Re: Because you guys/gals/girls/women/insert pc term here are a smart lot
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-285480@lists.php.net to get a copy of this message
On Mon, Jan 5, 2009 at 14:05, Frank Stanovcak <blindspotpro@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.brown@parasane.net || danbrown@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out!

« previous php.general (#285480) next »