Page 1 of 1

to null or not to null!

Posted: Mon Feb 16, 2009 7:46 am
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

Re: to null or not to null!

Posted: Mon Feb 16, 2009 8:33 am
by John Cartwright
From a performance standpoint, there is extremely little difference. However null would technically be faster.

Re: to null or not to null!

Posted: Mon Feb 16, 2009 9:18 am
by VladSun
I'm not sure it's true for MySQL, but I have read that "NULL values are not good for indexies".