Received: from localhost (uranus.hub.org [200.46.204.60]) by postgresql.org (Postfix) with ESMTP id 33EE89FB2A2 for ; Thu, 2 Nov 2006 11:25:40 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.60]) (amavisd-new, port 10024) with ESMTP id 95102-03-8 for ; Thu, 2 Nov 2006 11:25:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from white.netsurf.net (white.NetSurf.Net [66.135.102.134]) by postgresql.org (Postfix) with ESMTP id 2F0A79FB299 for ; Thu, 2 Nov 2006 11:25:36 -0400 (AST) Received: from [10.42.124.48] (synapticv-96.43.ADSL.NetSurf.Net [66.135.96.43]) by white.netsurf.net (8.13.4/8.13.4/Debian-3sarge3) with ESMTP id kA2FPWeO006081; Thu, 2 Nov 2006 10:25:32 -0500 Message-ID: <454A0DD3.2050104@alteeve.com> Date: Thu, 02 Nov 2006 10:25:07 -0500 From: Madison Kelly User-Agent: Thunderbird 1.5.0.7 (X11/20060909) MIME-Version: 1.0 To: Scott Marlowe CC: pgsql-performance@postgresql.org Subject: Re: Setting "nice" values References: <454A0B69.9070000@alteeve.com> <1162480836.28047.20.camel@state.g2switchworks.com> In-Reply-To: <1162480836.28047.20.camel@state.g2switchworks.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/27 X-Sequence-Number: 21797 Scott Marlowe wrote: > On Thu, 2006-11-02 at 09:14, Madison Kelly wrote: >> Hi all, >> >> I've got a script (perl, in case it matters) that I need to run once >> a month to prepare statements. This script queries and updates the >> database a *lot*. I am not concerned with the performance of the SQL >> calls so much as I am about the impact it has on the server's load. >> >> Is there a way to limit queries speed (ie: set a low 'nice' value on >> a query)? This might be an odd question, or I could be asking the >> question the wrong way, but hopefully you the idea. :) > > While you can safely set the priority lower on the calling perl script, > setting db backend priorities lower can result in problems caused by > "priority inversion" Look up that phrase on the pgsql admin, perform, > general, or hackers lists for an explanation, or go here: > > http://en.wikipedia.org/wiki/Priority_inversion > > I have a simple script that grabs raw data from an oracle db and shoves > it into a postgresql database for reporting purposes. Every 100 rows I > put into postgresql, I usleep 10 or so and the load caused by that > script on both systems is minimal. You might try something like that. Will the priority of the script pass down to the pgsql queries it calls? I figured (likely incorrectly) that because the queries were executed by the psql server the queries ran with the server's priority. If this isn't the case, then perfect. :) Thanks for the tip, too, it's something I will try. Madi