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.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 internal working of sql server.....

Author  Topic 

barretld
Starting Member

22 Posts

Posted - 2009-01-07 : 16:35:53
we have both the data files and log files on one 700Gig disk. I have a double cursor that runs sometimes in 15min or 2hours. If run for the second time right after the first it finishes in 2min always. Why does it sometimes run 15 min and most times 2hours?

I think it is very memory intensive. I set the maxdrop option to 4, we have 8 processors hyperthreaded.....so the problem must be the log file not big enough or free enough, or tell me more about page splits? The problem is weird because sometime it runs in 15 min and most times 2 hours.

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-01-07 : 16:47:36
Is it possible you can change cursors to set-based solutions? Did it involve in Locking/blocking/Dead-Locking?
Go to Top of Page

barretld
Starting Member

22 Posts

Posted - 2009-01-07 : 16:58:31
cursor is global, no one really uses sql server. What is set-based solution? No locking, no background stuff, just not sure......
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-01-07 : 17:06:19
quote:
Originally posted by barretld

cursor is global, no one really uses sql server. What is set-based solution?

Like changing cursors to While Loop.

No locking, no background stuff, just not sure......

You can run Sp_who2 active or activity monitor to see any blocking when Cursor is running for long time.


Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-01-07 : 17:41:06
sodeep,

Switching to a while loop is not a set-based solution. There is no performance improvement to using while loops instead of cursors.

barretld,

The reason why it is so fast if you run it twice in a row is due to caching.

Can you post the code?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -