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 |
|
PaulOrch
Starting Member
1 Post |
Posted - 2007-08-13 : 05:23:02
|
| I'm trying understand how the Estimated number of rows is calculated in SQL 2005. The scenario I have is a very simple query joining 2 tables. The first table can vary in size from < 10 to potentially millions although a few 100,000 is probably common. The other table is huge (500m). The query plan being generated can vary but most of the time it trying to do a nested loop join. The query plan is correctly calculating the estimated rows for the first table, but seems to be massively underestmating this for the second table. If I limit the search to 1 day they should be approx 16m rows in the large table for that day but then estimate number of rows is 100 using a certain non unique, non clustered index. Is there a simple way of being able to calculate this number based on the stats? If I force it to use the PK index it gets closer to the 16m. |
|
|
ashley.sql
Constraint Violating Yak Guru
299 Posts |
|
|
|
|
|