Re: Change query priority - Mailing list pgsql-general

From Tom Lane
Subject Re: Change query priority
Date
Msg-id 11094.1097425772@sss.pgh.pa.us
Whole thread Raw
In response to Re: Change query priority  (Michael Fuhr <mike@fuhr.org>)
Responses Re: Change query priority  (Michael Fuhr <mike@fuhr.org>)
Re: Change query priority  (Gaetano Mendola <mendola@bigfoot.com>)
List pgsql-general
Michael Fuhr <mike@fuhr.org> writes:
> I don't know how effective this would be, but you could wrap the
> system call setpriority() in a user-defined function if your
> platform supports it.  This would set the "nice" value of the
> backend process, which might serve as a crude prioritization
> mechanism.

Every couple of months someone comes along and says "why don't you
provide a way to renice a backend" ... but in point of fact it's
somewhere between useless and counterproductive for most query loads.
The "useless" part comes in because nice only affects CPU priority not
I/O priority, but I/O load is the thing that counts for most database
applications.  The "counterproductive" part comes in because of an
effect called priority inversion.  The niced-down process may be holding
a lock that is wanted by some higher-priority process --- but the kernel
scheduler knows nothing of that, and will leave the niced-down process
at the bottom of the queue, and thus the high-priority process is
effectively stuck at the bottom too.

If this were an easy problem to solve we'd have offered a solution long
ago ...

            regards, tom lane

pgsql-general by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Change query priority
Next
From: Michael Fuhr
Date:
Subject: Re: Change query priority