Type question.

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Type question.

Post by social_experiment »

Poor choice for a subject line but i hope my question explains it better. If i have a field with the type varchar 20 and the values inserted into the table are not always 20 characters long, will this cause any problems in terms of performance when retrieving the data?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Type question.

Post by Christopher »

I doubt anything noticeable. I recall researching the performance difference between CHAR and VARCHAR in MySQL. I think maybe long ago there was a difference in databases, but I don't think there is any difference anymore. Maybe someone has some definitive information.
(#10850)
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Type question.

Post by Benjamin »

No it's padded I believe in the data files anyway to a fixed length.
Post Reply