to null or not to null!

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
chidge
Forum Commoner
Posts: 29
Joined: Sat May 10, 2008 4:03 pm

to null or not to null!

Post by chidge »

so I have a table which is going to potentially contain quite a few empty or "null" values. (a comments table) This is due to several items being optional.

I am also looking into my table design (splitting the table into three and reducing entries rather than putting null entries in)

So what I am wondering is should i just leave colums blank? or put "null" into the coloums? What takes up more space and considering i wont be querying for "null" values I have no need for anything to be in there. - if it contains no value its not used.


Thanks

p.s im myisam and innodb
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: to null or not to null!

Post by John Cartwright »

From a performance standpoint, there is extremely little difference. However null would technically be faster.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: to null or not to null!

Post by VladSun »

I'm not sure it's true for MySQL, but I have read that "NULL values are not good for indexies".
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply