Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
chris_wood99
Yak Posting Veteran
70 Posts |
Posted - 2012-06-27 : 09:19:02
|
how do I rewrite this code as it is preventing the use of index seeks in my queriesAND AC.Dirty & 7 > 0 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2012-06-27 : 09:47:49
|
Redesign your table so that the bit values go into individual columns. |
 |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2012-06-27 : 11:28:25
|
<blab>Yep - a bitwise "aggregation" of attributes can be an efficient technique for storing a bunch of on/off attribute flags for an entity. It works well for presenting all the attributes for a given entity or for testing if any given attribute is on or off. But that technique breaks down (efficiency wise) when you need to search for entities by those attributes. The way I have modeled that to satisfy both simplicity and efficiency is to store them in a separate entityAttribute table - so ROWs of values per entity rather than columns across the entity table. Unless you have just a small, static set of attributes then columns are fine.</blab>Be One with the OptimizerTG |
 |
|
|
|
|