cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to set a priority to a SP or an event?

former_member329524
Active Participant
0 Kudos

Hello, all

I have a background background process (a stored procedure), which is lengthy and sometimes resource consuming.

However, it is nowhere near critical for speed, so if it were a regular windows process, I would have launched it with low priority.

My question is, can I start a process in SQL Anywhere, which would clear itself from CPU if other request come in?

Thank you

Arcady

Accepted Solutions (1)

Accepted Solutions (1)

former_member244518
Participant
0 Kudos

Hi Arcady,

You can execute


SET TEMPORARY OPTION priority = 'BACKGROUND';

as the first line of the stored procedure. This will mark entire connection as a background priority task (similar to setting a processes priority in Windows).

When the stored procedure is completed, you'll want to make sure you set the priority back to a normal level. If the procedure is triggered in an event, this method will still be effective. When an event is fired it has an internal connection created for it.

Although we do not completely remove the task from the CPU (I imagine this could lead to some deadlocks), we ensure it gets significantly less CPU time then other connections.

Hope this helps,

Mikel

former_member329524
Active Participant
0 Kudos

Thank you, Mikel

And if this procedure is launched from another stored procedure based on some dynamic condition. Will this line also work?

Answers (0)