plainblack.com
Username Password
search
Bookmark and Share

    

char vs varchar

User JT
Date 10/21/2008 10:15 am
Views 1422
Rating 0    Rate [
|
]
Previous · Next
User Message
JT
Going forward any place in WebGUI that you use a varchar in database  
table construction, use a char instead. We will be updating WebGUI to  
use chars instead of varchars everywhere. The reason for this change  
is that chars perform better and are less likely to cause MYISAM  
corruption issues. The change doesn't come without a cost though. It  
means that the tables will use slightly more disk space. But my  
thinking is that disk space is cheap compared to any performance  
benefit at all, and the cost of downtime due to possible MYISAM table  
crashes.

JT Smith
ph: 703-286-2525 x810
fx: 312-264-5382

Create like a god. Command like a king. Work like a slave.



Back to Top
Rate [
|
]
 
 
knowmad

This sounds reasonable. Did you come across an article that details the reasons behind your decisions? Please share.

 

William

----
Knowmad Technologies
http://www.knowmad.com



Back to Top
Rate [
|
]
 
 
JT
Not a particular article, just through user testing. There was  
something on the MySQL site (I forget where) that said that CHAR is  
more stable than VARCHAR, but it wasn't particularly specific. We had  
a client who kept getting corrupted cache and assetIndex tables. I  
couldn't figure out what it was about. On a hunch I changed all the  
fields in those two tables that were varchars to chars and we haven't  
had a corruption in a month. It was corrupting every day, sometimes  
more than once per day.

Also if you read the docs on the MySQL site it flat out says that  
CHARS are more speedy than VARCHARS in certain situations simply  
because CHARS have a known length, so there is less scanning work.


Back to Top
Rate [
|
]
 
 
dionak
Interesting. Thanks for sharing.

On Tue, Oct 21, 2008 at 6:25 PM, <jt@plainblack.com> wrote:
JT wrote:

Not a particular article, just through user testing. There was  
something on the MySQL site (I forget where) that said that CHAR is  
more stable than VARCHAR, but it wasn't particularly specific. We had  
a client who kept getting corrupted cache and assetIndex tables. I  
couldn't figure out what it was about. On a hunch I changed all the  
fields in those two tables that were varchars to chars and we haven't  
had a corruption in a month. It was corrupting every day, sometimes  
more than once per day.

Also if you read the docs on the MySQL site it flat out says that  
CHARS are more speedy than VARCHARS in certain situations simply  
because CHARS have a known length, so there is less scanning work.


http://www.plainblack.com/webgui/dev/discuss/char-vs-varchar/2


--



Plain Black&#44; makers of WebGUI

http://plainblack.com





--
Knowmad Technologies - Open Source Software Solutions
W: http://www.knowmad.com | E: diona@knowmad.com
P: 704.343.9330 | http://www.LinkedIn.com/in/dionakidd


Back to Top
Rate [
|
]
 
 
    



© 2012 Plain Black Corporation | All Rights Reserved