I can't remember the source, but I recall reading that you should not
use columns that are mostly null or have very few unique values (low
cardinality).  In those instances, you would create a separate table
that contains only those records, just as you mentioned.

If you create a separate table, just for featured articles, you can
query that table w/o much performance penalty.  If you have the correct
indexes on both tables, you should also be fine.

On the other hand, you would then have to maintain data in two, or more,
tables rather than one.

How many articles, in total, do you expect to have?  I can't imagine a
problem unless you are dealing with tens of thousands of records.

If you have hundreds of thousands of records, and performance sucks,
then you could create a duplicate articles table that contains ONLY
featured articles, in full.  An administrator would perform an action
that would copy an article's entire record to the featured table.  When
an article is no longer featured, the record would be removed from the
featured table.

Of course, you would need to consider any modifications to a featured
article.  You would need to update in both tables.  A trigger would make
this process relatively simple.

M!ke

-----Original Message-----
From: Aaron Roberson [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 09, 2007 8:01 PM
To: CF-Talk
Subject: Help with DB design delimma

Hey all,
Here is my simple use case: I have a table of articles. I would like to
indicates some as featured.

Here is my dilemma: Since only a few rows in the table will be featured
articles I figured it would be bad to have an "isfeatured" field in the
table. Why have a field for every row when a small minority will
actually use it? My thought was to create a second table with all of the
featured article id's. However, should I really create a table with one
field just for maintaining a list of article id's?

What would be the "best" approach?

Thanks,
Aaron

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion 8 - Build next generation apps
today, with easy PDF and Ajax features - download now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:290714
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to