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 |
|
EWDBA
2 Posts |
Posted - 2006-03-08 : 14:17:41
|
Hi all, I have been running into this same issue for some time now and can't come up with a valid reason why SQL is doing what s is doing...In a nut shell I have three tables t1 is a fact tablet2 is a time dimension tablet3 is a parameter table that get loaded prior to the query being executed.Simple codeSelect count (t1.stuff) From t1Inner join t2Ont1.date_key = t2.date_key Inner join t3ont2.date_number between t3.start_date and t3.end_date The optimizer performs a full table scan on the fact then applies the date range filter... Though if I were to replace the start_date and end_date values with hardcode values then the optimizer uses the index and pulls only those records needed from the fact.Really weird...Any thoughts?ThanksEric |
|
|
activecrypt
Posting Yak Master
165 Posts |
Posted - 2006-03-08 : 22:12:25
|
| Hi,would you post table structure , index and some sample data ?RegardsAndy DavisSql Shield Team--------------------------------------------SQL Server Encryption Softwarehttp://www.sql-shield.com |
 |
|
|
|
|
|