We have a complicated stored procedure that we run frequently. It
pegs one of our postmaster processes at 100% CPU utilization for a few
hours. This has the unfortunate side effect of causing increased
latency for our other queries. We are currently planning a fix, but
because of the complicated nature of this procedure it is going to
take some time to implement.
I've noticed that if I renice the process that is running the query,
the other postmaster processes are able to respond to our other
queries in a timely fashion.
My question: Is there a way I can decrease the priority of a specific
query, or determine the PID of the process it is running in? I'd like
to throw together a quick shell script if at all possible, as right
now I have to monitor the process manually and we'll have fixed the
problem long before we have the chance to implement proper database
clustering.
Bryan