RE: [PHP-DB] Column Defualts
This should be useful, mysql-wise: http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Optimisation.html#Data_size Declare columns to be NOT NULL if possible. It makes everything faster and you save one bit per column. Note that if you really need NULL in your application you should definitely use it. Just avoid having it on all columns by default. Peter On Tue, 29 Oct 2002, Peter Beckman wrote: > With MySQL you save a bit by declaring a column not null. If it is null, > you are using a bit. For performance on high volume and high transaction > servers, declaring your columns not null will help, if only slightly. > > Peter > > On Tue, 29 Oct 2002, Ryan Jameson (USA) wrote: > > > No, I believe all databases have an isnull bit flag to go with any column > > stored. So whether you set it or not the bit is being used. > > > > <>< Ryan > > > > -Original Message- > > From: Gerard Samuel [mailto:gsam@;trini0.org] > > Sent: Tuesday, October 29, 2002 9:47 AM > > To: php-db > > Subject: [PHP-DB] Column Defualts > > > > > > Is defaulting a column to NULL considered as a waste of space?? > > I have a table that has 2 columns (so far) that defualt to NULL, and > > potentially, > > there can be good amount of rows with NULL. Just wondering... > > > > -- > > Gerard Samuel > > http://www.trini0.org:81/ > > http://dev.trini0.org:81/ > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > --- > Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation > [EMAIL PROTECTED] http://www.purplecow.com/ > --- > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Column Defualts
With MySQL you save a bit by declaring a column not null. If it is null, you are using a bit. For performance on high volume and high transaction servers, declaring your columns not null will help, if only slightly. Peter On Tue, 29 Oct 2002, Ryan Jameson (USA) wrote: > No, I believe all databases have an isnull bit flag to go with any column > stored. So whether you set it or not the bit is being used. > > <>< Ryan > > -Original Message- > From: Gerard Samuel [mailto:gsam@;trini0.org] > Sent: Tuesday, October 29, 2002 9:47 AM > To: php-db > Subject: [PHP-DB] Column Defualts > > > Is defaulting a column to NULL considered as a waste of space?? > I have a table that has 2 columns (so far) that defualt to NULL, and > potentially, > there can be good amount of rows with NULL. Just wondering... > > -- > Gerard Samuel > http://www.trini0.org:81/ > http://dev.trini0.org:81/ > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Column Defualts
Also note that many databases calculate the maximum allowable rowsize and allocate that much space whether it's populated or not. This is especially evident when you use char types verses varchar types. It's actually a good thing in most cases that they do, since it allows query algorithms to be more efficient when jumping to the next row is always the same distance and forces records to be stored sequentially. I'd trade disk space for performance any day... <>< Ryan -Original Message- From: Ryan Jameson (USA) Sent: Tuesday, October 29, 2002 10:30 AM To: php-db Subject: RE: [PHP-DB] Column Defualts No, I believe all databases have an isnull bit flag to go with any column stored. So whether you set it or not the bit is being used. <>< Ryan -Original Message- From: Gerard Samuel [mailto:gsam@;trini0.org] Sent: Tuesday, October 29, 2002 9:47 AM To: php-db Subject: [PHP-DB] Column Defualts Is defaulting a column to NULL considered as a waste of space?? I have a table that has 2 columns (so far) that defualt to NULL, and potentially, there can be good amount of rows with NULL. Just wondering... -- Gerard Samuel http://www.trini0.org:81/ http://dev.trini0.org:81/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Column Defualts
No, I believe all databases have an isnull bit flag to go with any column stored. So whether you set it or not the bit is being used. <>< Ryan -Original Message- From: Gerard Samuel [mailto:gsam@;trini0.org] Sent: Tuesday, October 29, 2002 9:47 AM To: php-db Subject: [PHP-DB] Column Defualts Is defaulting a column to NULL considered as a waste of space?? I have a table that has 2 columns (so far) that defualt to NULL, and potentially, there can be good amount of rows with NULL. Just wondering... -- Gerard Samuel http://www.trini0.org:81/ http://dev.trini0.org:81/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php