Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 2F8C62E3138 for ; Fri, 14 Mar 2008 21:25:24 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 55375-04 for ; Fri, 14 Mar 2008 21:25:14 -0300 (ADT) X-Greylist: delayed 00:24:53.931223 by SQLgrey-1.7.5 Received: from mailout.abaca.com (mailout.abaca.com [75.59.196.2]) by postgresql.org (Postfix) with ESMTP id 5C1DE2E3135 for ; Fri, 14 Mar 2008 21:25:21 -0300 (ADT) Received: from v-abaca-epg.lab.abaca.com (localhost.localdomain [127.0.0.1]) by v-abaca-epg.lab.abaca.com (Postfix-out) with ESMTP id 4F67A11007E for ; Fri, 14 Mar 2008 17:03:49 -0700 (PDT) X-Propel-Return-Path: Received: from mailout.abaca.com ([172.16.83.19]) by [127.0.0.1] ([127.0.0.1]) (port 7027) (Abaca EPG outproxy filter 3.1.0.8749 $Rev: 8725 $) id 5uNZr83f03N0; Fri, 14 Mar 2008 17:03:49 -0700 Received: from mail.abaca.com (unknown [172.16.83.4]) by v-abaca-epg.lab.abaca.com (Postfix-out) with ESMTP id 1897A110063 for ; Fri, 14 Mar 2008 17:03:49 -0700 (PDT) Received: from [172.16.83.73] (172.16.83.73) by mail.abaca.com (172.16.83.4) with Microsoft SMTP Server id 8.0.744.0; Fri, 14 Mar 2008 17:01:15 -0700 Subject: best way to run maintenance script From: Vinubalaji Gopal To: "Pgsql-Performance ((E-mail))" Content-Type: text/plain Date: Fri, 14 Mar 2008 17:00:21 -0800 Message-ID: <1205542821.12661.16.camel@vinu-ubuntu.abaca> MIME-Version: 1.0 X-Mailer: Evolution 2.12.1 Content-Transfer-Encoding: 7bit X-Propel-ID: 5uNZr83f03N0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200803/321 X-Sequence-Number: 29275 Hi all, I have been searching for the best way to run maintenance scripts which does a vacuum, analyze and deletes some old data. Whenever the maintenance script runs - mainly the pg_maintenance --analyze script - it slows down postgresql inserts and I want to avoid that. The system is under constant load and I am not interested in the time taken to vacuum. Is there a utility or mechanism in postgresql which helps in reducing priority of maintenance queries? Is writing a postgresql C function and setting the priority of process the only way to change the priority of the maintenance script or is there a better way. http://weblog.bignerdranch.com/?p=11 I tried using the nice command (Linux system) on the maintenance script - it did not have any effect - guess it does not change the niceness of the postgresql vacuum process. (I am running Postgresql 8.0 on a Linux) -- Vinu