From: | Josh Kupershmidt <schmiddy(at)gmail(dot)com> |
---|---|
To: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: get/set priority of PostgreSQL backends |
Date: | 2012-04-07 18:31:16 |
Message-ID: | CAK3UJRFXugKxTaBvS=kyPzaLGgHy5Y9a=F_ReYtqbm0WPUhU6Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Sat, Apr 7, 2012 at 11:05 AM, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> wrote:
> On Sat, Apr 7, 2012 at 11:06 AM, Josh Kupershmidt <schmiddy(at)gmail(dot)com> wrote:
>> The wiki says nice_backend_super() might be able to "renice any
>> backend pid and set any priority, but is usable only by the [database]
>> superuser", hinting that it would be feasible to lower a backend's
>> priority value (i.e. increase the scheduling priority). Unfortunately
>> this is not possible on at least OS X and Linux, where one must be
>> root to lower priority values. I haven't checked whether this module
>> works on Windows, would appreciate if someone could give it a shot
>> there.
>
> I thought you were limited to only settings above 0 and your own
> processes in linux.
For non-root users, you may always only *increase* the priority values
of your processes, and the default priority value is 0. So yes as
non-root, you're effectively limited to positive and increasing values
for setpriority(), and of course you may only alter process priorities
running under the same user. I think that's what I was saying above,
though maybe I wasn't so clear.
For example, if you try to lower your own backend's priority with this
function, you'll get a warning like this:
test=# SELECT set_backend_priority(pg_backend_pid(), -1);
WARNING: Not possible to lower a process's priority (currently 0)
set_backend_priority
----------------------
f
(1 row)
Josh
From | Date | Subject | |
---|---|---|---|
Next Message | Lukas | 2012-04-08 18:30:58 | Stats |
Previous Message | Scott Marlowe | 2012-04-07 18:05:04 | Re: get/set priority of PostgreSQL backends |