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 |
anulot1331
Starting Member
2 Posts |
Posted - 2012-04-02 : 09:41:25
|
Hi all, I need help with a problem than I have in SQL Server 2005. I'm executing a query with several joins, and when I execute the query It delay 6 minutes.The strange thing, It's that when I reinsert all the rows in one of the tables, the query delay only 10 seconds. Actually every day I have a process that it insert new records in this table, and It's when this process happens, when my query delay 6 minutes again.Do anyone has an idea that could happen?Thanks very much in advance.greetings. |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2012-04-02 : 12:34:10
|
It's not about reinserting the data again.First time you run hour query, if the query plan doesn't exist in plan cache, the plan has to be evaluated and stored.Also, first time the data is accessed, if has to be fetched from drive and stored in buffer pool.Next time you run your query and access same rows, you will get your data from buffer pool directly which is much faster.Hence the time difference between 6 minutes and 10 seconds. N 56°04'39.26"E 12°55'05.63" |
|
|
anulot1331
Starting Member
2 Posts |
Posted - 2012-04-03 : 03:06:06
|
Thank you for your answer, but it isn't problem with the cache, because if I don't reinserting all de rows in the table, the query delay 6 minutes al the day, regardless of how many times I run it.Greetings. |
|
|
|
|
|
|
|