If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Table Design for a column with only a few records

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-07-11, 10:05
occurred occurred is offline
Registered User
 
Join Date: Sep 2011
Posts: 1
Table Design for a column with only a few records

Hi,

I've a table and a column in this table will only be used/has a value for about 1% of all records.
What will be the best design priciple for such a column?

cheers
Charlie
Reply With Quote
  #2 (permalink)  
Old 09-07-11, 11:04
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
either
define the column, and allow null values
OR
take a more zealous approach (if you believe all nulls are bad) and create a table just to hold that one value.

the second approach is probably more space efficient (as you only store the column when required, although there will be some negligible overhead)
the first approach probably more run time efficient (as there is one less join to process).

there are those who advocate that null brakes the rules of relational db design.
...and there are those who don't believe that a NULL value has any place in a DB schema
...and there are those who think NULL's are perfectly acceptable values (as long as you now why you are allowing NULL's in the first place and handle them correctly)
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 09-07-11, 11:22
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
What is the datatype of the column?
Space is likely not a significant concern. I'd almost always recommend option 1, not being a "null purist".
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
Reply With Quote
  #4 (permalink)  
Old 09-07-11, 12:26
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Quote:
Originally Posted by healdem View Post
... null brakes the rules of relational db design.
certainly slows 'em down a bit, eh
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 09-07-11, 13:07
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
Quote:
Originally Posted by r937 View Post
certainly slows 'em down a bit, eh
oops sorry about that, been playing to much wordscraper.....
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #6 (permalink)  
Old 09-07-11, 14:57
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
...been playing too much wordscraper....
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On