Re: Change query priority

From: Dawid Kuroczko <qnex42(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Change query priority
Date: 2004-10-10 15:52:32
Message-ID: 758d5e7f0410100852168820aa@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 10 Oct 2004 19:12:51 +0400, Eugeny Balakhonov <c0ff75(at)mail(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-10-10 15:53:15 Re: Rule problem
Previous Message Eugeny Balakhonov 2004-10-10 15:12:51 Change query priority