I know this sounds weird but this is a First time I run the query against database, it takes 25 to 30secs and the second time ~13secs (±2secs), the third time 25secs again, so the cycle goes on. It's exactly the same query every time. Do you have any idea how or why this could happen? Maybe because of disk fragmentation? Or for some reason the cache "invalidates" itself after the second run? (this was a wild one) Unfortunately I cannot expose the full query but its format is like this: WITH SubQuery (...) as (SELECT ..., row_number() over (...) FROM ....) WHERE .... SELECT ... FROM SubQuery WHERE ... Note: No other processes were interacting with the db at the time of test. asked 19 Sep '11, 02:22 henginy |
You haven't posted enough details for us to help you. Some ideas:
Attaching graphical plans with statistics for the problem query (for both cases) would be a good idea. answered 19 Sep '11, 07:55 Glenn Paulley Thank you for the answer and pointers. I'll gather more information in this direction and edit my post.
(19 Sep '11, 09:27)
henginy
The computer was on the site and offline so it was not possible to collect further data. But looking at other different problems it was most probably due to harddisk or RAID-related.
(18 Jan '12, 10:06)
henginy
How does one attach a graphical plan without exposing the query? ...I suppose one could manually edit the XML but that might not be sufficient to satisfy auditors etcetera.
(18 Jan '12, 11:26)
Breck Carter
|