List:General Discussion« Previous MessageNext Message »
From:Olaf Stein Date:February 25 2009 6:27pm
Subject:Re: Cost of using over dimensioned columns
View as plain text  
Morten,

Check out
http://dev.mysql.com/doc/refman/5.1/en/storage-requirements.html

For example, the cost of longtext (L+4 bytes) over mediumtext (L+3 bytes) is
1 byte per record. If you have a lot of records this might be significant.

In the case of varchar it is similar, L+1 if less than 255 bytes, L+2 if
more.

In general it is good practice to define columns types as tight as possible,
if you have a username field and you do not want more than 25 characters
long username, you would define username varchar(25).

Olaf



On 2/25/09 11:52 AM, "Morten" <my.lists@stripped> wrote:

> Hi list,
> 
> I'm wondering what the "cost" (if any) is by using eg. mediumtext
> over  text, or largetext over mediumtext. Is there a non-negligible
> reason to not just just  largetext?
> 
> And how about varchars, what's the "cost" of using varchar(1000)
> rather than varchar(20)?
> 
> My intuition tells me that I should keep things as tight as possible,
> but I may be narrow minded and need a sanity check.
> 
> Thanks!
> 
> Morten
> 
> 

----------------------------------------- Confidentiality Notice:
The following mail message, including any attachments, is for the
sole use of the intended recipient(s) and may contain confidential
and privileged information. The recipient is responsible to
maintain the confidentiality of this information and to use the
information only for authorized purposes. If you are not the
intended recipient (or authorized to receive information for the
intended recipient), you are hereby notified that any review, use,
disclosure, distribution, copying, printing, or action taken in
reliance on the contents of this e-mail is strictly prohibited. If
you have received this communication in error, please notify us
immediately by reply e-mail and destroy all copies of the original
message. Thank you.
Thread
Cost of using over dimensioned columnsMorten25 Feb
  • Re: Cost of using over dimensioned columnsOlaf Stein25 Feb