View Single Post
Old 02-07-2013, 03:20 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,200
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
What is "Toxi"? Where did that come from?

Wherever, it's also the properly normalized version.

If you truly have the limitations you specified and you 100%-promise-to-delete-the-entire-site-if-you-change-your-mind-kind-of-sincerity that those limitations won't changed, then a little bit of denormalization as you propose would surely not hurt.

Would it help? I tend to doubt it.

I would like to point out that if you do denormalize then there are several possible future queries that get tougher. Example:
"How many bookmarks use both tag13 and tag93?"
[WHERE (tag1=13 AND tag2=93) OR (tag1=93 AND tag2=13)]
[ugh!]

"How many bookmarks have only one tag?"
[WHERE (tag1 IS NOT NULL AND tag2 IS NULL) OR (tag1 IS NULL AND tag2 IS NOT NULL]
[double ugh!]

"How many bookmarks use exactly the same two tags as another bookmark?"
[much more code than I want to show]

All those--and more--are trivial in the fully normalized ("Toxi") case.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Users who have thanked Old Pedant for this post:
shaunthomson (02-07-2013)