Jump to content

Never use VARCHAR?


freelance84

Recommended Posts

I recently came across this link: http://www.softwareprojects.com/resources/programming/t-never-use-varchar-in-mysql-1916.html

 

The person who wrote it states it is best to never use VARCHAR and use either CHAR or TEXT, claiming the space saved is negligible compared to the problems it can cause.

 

There has only been one post to his claims but wondered if any one else had any comments on it... (i use varchar a lot due to the book i learnt from)

Link to comment
https://forums.phpfreaks.com/topic/227989-never-use-varchar/
Share on other sites

Yeah, that's nonsense.

 

The mismatch issue is just poor DBA management -- that will happen with CHAR, too.

 

The conversion at lower length doesn't matter.

 

And MySQL 5 support VARCHAR up to 65k, so there's no need to get into TEXT/BLOB hell for >255 anymore.

 

Yes, if most of your data is taking up most of the VARCHAR space, then you don't get any benefit from the variable length aspect, and don't bother.  But in the real-world, it's impossible to know.

 

Also -- and the blog neglected to mention this -- if you have even one variable-length field in your table, you won't get any benefit from the fixed-width ones.  In fact, I'm fairly certain that they get converted to VARCHAR without even asking you.

Link to comment
https://forums.phpfreaks.com/topic/227989-never-use-varchar/#findComment-1175783
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.