X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4EFDA5281F for ; Mon, 11 Jul 2005 10:07:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43269-07 for ; Mon, 11 Jul 2005 13:07:43 +0000 (GMT) Received: from mailhost.intellivid.com (mailhost.intellivid.com [64.32.200.11]) by svr1.postgresql.org (Postfix) with ESMTP id AB5A852802 for ; Mon, 11 Jul 2005 10:07:43 -0300 (ADT) Received: from [192.168.2.68] (spectre.intellivid.com [192.168.2.68]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by newmail.intellivid.com (Postfix) with ESMTP id 8379EF1829C; Mon, 11 Jul 2005 09:07:46 -0400 (EDT) Subject: Re: cost-based vacuum From: Ian Westmacott To: Simon Riggs Cc: pgsql-performance@postgresql.org In-Reply-To: <1121081504.3970.53.camel@localhost.localdomain> References: <1120839902.20657.197.camel@spectre.intellivid.com> <1121081504.3970.53.camel@localhost.localdomain> Content-Type: text/plain Organization: Intellivid Corp. Message-Id: <1121087266.27427.35.camel@spectre.intellivid.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Mon, 11 Jul 2005 09:07:46 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200507/105 X-Sequence-Number: 13346 On Mon, 2005-07-11 at 07:31, Simon Riggs wrote: > The ANALYZE commands hold read locks on the tables you wish to write to. > If you slow them down, you merely slow down your write transactions > also, and then the read transactions that wait behind them. Every time > the ANALYZE sleeps it wakes up the other transactions, which then > realise they can't move because of locks and then wake up the ANALYZEs > for another shot. The end result is that you introduce more context- > switching, without any chance of doing more useful work while the > ANALYZEs sleep. Let me make sure I understand. ANALYZE acquires a read lock on the table, that it holds until the operation is complete (including any sleeps). That read lock blocks the extension of that table via COPY. Is that right? According to the 8.0 docs, ANALYZE acquires an ACCESS SHARE lock on the table, and that conflicts only with ACCESS EXCLUSIVE. Thats why I didn't think I had a lock issue, since I think COPY only needs ROW EXCLUSIVE. Or perhaps the transaction needs something more? Thanks, --Ian