Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 8ACE6650E81 for ; Mon, 30 Jun 2008 16:00:51 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 57817-03 for ; Mon, 30 Jun 2008 16:00:46 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id CD22D650E8C for ; Mon, 30 Jun 2008 16:00:47 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m5UJ0eip003065; Mon, 30 Jun 2008 15:00:41 -0400 (EDT) To: Alvaro Herrera cc: Peter Schuller , pgsql-performance@postgresql.org Subject: Re: VACUUM ANALYZE blocking both reads and writes to a table In-reply-to: <20080630162306.GA18252@alvh.no-ip.org> References: <20080630145903.GA15197@hyperion.scode.org> <20080630152515.GF10311@alvh.no-ip.org> <20080630154318.GB15756@hyperion.scode.org> <20080630162306.GA18252@alvh.no-ip.org> Comments: In-reply-to Alvaro Herrera message dated "Mon, 30 Jun 2008 12:23:06 -0400" Date: Mon, 30 Jun 2008 15:00:40 -0400 Message-ID: <3064.1214852440@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200806/246 X-Sequence-Number: 30596 Alvaro Herrera writes: > Peter Schuller wrote: >> Even with the fix the lock is held. Is the operation expected to be >> "fast" (for some definition of "fast") and in-memory, or is this >> something that causes significant disk I/O and/or scales badly with >> table size or similar? > It is fast. Well, it's *normally* fast. In a situation where there are a whole lot of empty pages at the end of the table, it could be slow. That's probably not very likely on a heavily used table. One should also note that (1) The only way vacuum will be able to obtain an exclusive lock in the first place is if there are *no* other transactions using the table at the time. (2) If it's autovacuum we're talking about, it will get kicked off the table if anyone else comes along and wants a conflicting lock. regards, tom lane