Re: Change query priority - Mailing list pgsql-general

From Dawid Kuroczko
Subject Re: Change query priority
Date
Msg-id 758d5e7f0410100852168820aa@mail.gmail.com
Whole thread Raw
In response to Change query priority  ("Eugeny Balakhonov" <c0ff75@mail.ru>)
List pgsql-general
On Sun, 10 Oct 2004 19:12:51 +0400, Eugeny Balakhonov <c0ff75@mail.ru> wrote:
> I have a web site which uses PostgreSQL as a host database and a background
> program which uses this database too.
>
> I want to change priority for database queries of this background program to
> "low" and change priority for web site database queries to "high".
>
> It is possible?

I think you could create a daemon/cron job which would get process ids of
servers and renice them, like for instance (assuming perl script):

while (1) {
   my @pids = map { $_->[0] } @{$dbh->selectall_arrayref("select
procpid from pg_stat_activity where usename = 'apache'")};
   system("renice -10 @pids");
   sleep 300;
}

Or something like this.  SIlly idea but might do the trick.

pgsql-general by date:

Previous
From: "Eugeny Balakhonov"
Date:
Subject: Change query priority
Next
From: Tom Lane
Date:
Subject: Re: Rule problem