VIVEKANANDHAN_PERIASAMY
asked on
SQL Performance issue
I have 2 environment say A & B. A is the testing phrase 1 environment and B is testing phrase 2 env.
In A env I have database which holds more data than env B. When I run a select query on Env A it get's executed fast(say 40 seconds.)Same query executing on env B takes 50 minutes.
Result of this query doesn't return any records.It will be 0.
The select query has 15 joins.No aggregation/calculation is performed in this query. It's just selecting a columns.
In A env I have database which holds more data than env B. When I run a select query on Env A it get's executed fast(say 40 seconds.)Same query executing on env B takes 50 minutes.
Result of this query doesn't return any records.It will be 0.
The select query has 15 joins.No aggregation/calculation is performed in this query. It's just selecting a columns.
1.Below are my analysis details:
I saw the execution plan on both ENV.
In A estimated number & actual number of rows is 0
In B estimated number = ~76 millions & actual number of rows is 0
2.Fragmentation:
In env a= ~0.99 for all 15 tables
In env b = ~ 14 for all 15 tables
3.Same query executing without where clause in B is taking just 1 minute.
Should I update the statistics?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just trying to understand why estimated rows is high for env B.
When was the last time statistics were updated?
When was the last time statistics were updated?
Two things you can try to updating your statistics ..
Another optimize your query , it may help as the same can behave differently in different environment as per data volume...
And chk out your indexes...
Another optimize your query , it may help as the same can behave differently in different environment as per data volume...
And chk out your indexes...
ASKER
My concerns here, env having large number of records executes fast ( less than minute) and environment having less records taking long time (morethan 50 minutes). Both output are the same,both have same number of indexes.
I have just like know why the estimated number of records is high(~75 million) in one and 0 in another.So like to understand what is happening inside the database engine.
I have just like know why the estimated number of records is high(~75 million) in one and 0 in another.So like to understand what is happening inside the database engine.
I have just like know why the estimated number of records is high(~75 million) in one and 0 in another.
Let's try that again, as you may have overlooked my comment:
Let me know if you do not understand the relevance of the question and why it may address your specific question.
Let's try that again, as you may have overlooked my comment:
When was the last time statistics were updated?
Let me know if you do not understand the relevance of the question and why it may address your specific question.
ASKER
>>Should I update the statistics? <<
Running sp_updatestats fixed the issue.
Running sp_updatestats fixed the issue.
ASKER
But I confirm that,both has same indexes I missed to mention this point while posting.
Just trying to understand why estimated rows is high for env B.