Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute sql with low priority?

Status
Not open for further replies.

jenlion

IS-IT--Management
Nov 13, 2001
215
I have a query that spikes the CPU. Working on optimizing it but that's taking awhile. (It only reads - no writes).

Is it possible to assign a low priority to this query so that other people can get their work done while this runs in background, even it takes longer?

I don't think there is, but hoping somebody here can tell me for sure.

Thanks
 
I'm not sure if this is exactly related, but I saw a similar question on another forum.

Here is a suggestion from Paul Mrozowski:
=======================================================
Can you just start it up on a new thread?

C# Version
public class MySample
{
public void DoSomething()
{
// Code runs Stored Proc
}
}

MySample sample = new MySample();
System.Threading.Thread thread = new System.Threading.Thread(sample.DoSomething);
thread.Start();

''VB Version

Public Class MySample
Public Sub DoSomething()
'' Code runs Stored Proc
End Sub
End Class

Dim sample As MySample = New MySample()
Dim thread As System.Threading.Thread = New System.Threading.Thread(sample.DoSomething)
thread.Start()

I use a variation of this for some of the things I do where I fire off an event async:

 
Unfortunatley, threading won't help on the db end, it will still spike the cpu, event if the db access is on it's own thread.
 
In SQL 2008, there is a resource governor. That can cause the SPID to slow down, but I have not played around with it enough to see if it can be applied to individual stored procedures, or if it only affects at a user level.
 
I saw that about 2008. Unfortunately, I'm in 2000 for now, and only get to upgrade to 2005 soon. 2008 will be years away. :-(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top