MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 10th, 2004, 09:08 AM
DanBaker DanBaker is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 3 DanBaker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question quick question: varchar(SIZE)

Quick Question: does the size of a varchar alter performance or storage requirement at all?
Example:
... If I have "apples" as the value.
... If the field is defined as varchar(255) or varchar(100)
... won't both definitions use the same amount of storage space?
My understanding: Doesn't the varchar size simply limit the length of the data allowed to be stored?

Thank you
Dan Baker

Reply With Quote
  #2  
Old July 13th, 2004, 01:03 PM
PcCowboy PcCowboy is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 6 PcCowboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi Dan,

MySQL handles the varchar the same nomatter what the size. The only performance difference is caused by the extra time needed to read additional characters from the storage space.

Hope this helps...
PcCowboy

Reply With Quote
  #3  
Old July 13th, 2004, 01:07 PM
PcCowboy PcCowboy is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 6 PcCowboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by DanBaker
Quick Question: does the size of a varchar alter performance or storage requirement at all?
Example:
... If I have "apples" as the value.
... If the field is defined as varchar(255) or varchar(100)
... won't both definitions use the same amount of storage space?
My understanding: Doesn't the varchar size simply limit the length of the data allowed to be stored?

Thank you
Dan Baker

Hi Dan,

One more thing, MySQL allocates the number of characters that you specify. The storage area will only be read to the end of the string. So, varchar(200) and varchar(100) will allocate different amounts of storage space. It will however, require the same ammount of time to read 'apple' from storage defined as varchar(100) or varchar(200).

PcCowboy

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > quick question: varchar(SIZE)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT