RE: [PHP] Mysql/php database performance question
| From: | Matt Schroebel | Date: | Fri, 10 Jan 2003 16:54:54 +0000 |
| Subject: | RE: [PHP] Mysql/php database performance question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-131144@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Marek Kilimajer [mailto:kilimajer@webglobe.sk]
> Sent: Friday, January 10, 2003 11:45 AM
> To: Matt Schroebel
> Cc: Simon Dedeyne; php-general@lists.php.net
> Subject: Re: [PHP] Mysql/php database performance question
>
>
> Sure, just tried it (32-bit platform, might be >7 for 64-bits).
> I have a feeling it is somewhere in the manual.
How'd you try it?
I created a 1 column 42 char record in phpMyAdmin. Everytime I add a
row, regardless of size the dataspace increases by 42.
With a second table, with 1 column varchar(42), each 4-5 char insert
resulted in 20 bytes of space (must be some minimum overhead), and a
full 42 resulted in 44 bytes of dataspace used.
I'm curious here, as it seems the trade off is speed of access with char
[and the overhead of removing trailing spaces on each retrieval] vs
storage size in varchar [and it's improved strip right spaces on storage
only happening once]. That's what the man page I pointed to last time
said. There are some examples of truncating data to 4 bytes on that
page but no mention of storing char as varchar.