Search This Blog

Friday, December 9, 2011

Regarding Query Performance

Question:

I am sql server 2008. In my table contain more than 6 lac's records.
 
In that i need to get latest rate.
When i am  calling  store procedure first time then it will taking more time(30 to 35 sec). Imminently i am executing means it is giving with in 6 sec.
and means 1 sec.

 
After 1 hour i am trying to executing same store procedure then again it is same problem.
 
I can't figure it out what is problem.

Answer:


I hope you have created Indexes on the table from which you are fetching the data.
 
Also i would suggest that instead of performing the operations on the Actual table, its better to take the necessary data into Temporary Table or Table Variable based upon some criteria. Then do operations on this temp table.
 
if you could post the structure of the table and what is the actual purpose of the stored procedure, it will be easy for the group to help you out.

 

No comments:

Post a Comment