Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 6C8D4650573 for ; Tue, 22 Jul 2008 17:02:36 -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 09047-02-7 for ; Tue, 22 Jul 2008 17:02:20 -0300 (ADT) Received: from mx3.hub.org (mx3.hub.org [206.223.169.73]) by postgresql.org (Postfix) with ESMTP id 1CC756509DE for ; Tue, 22 Jul 2008 16:10:48 -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 mx3.hub.org (Postfix) with ESMTP id AA33F37CA53 for ; Tue, 22 Jul 2008 14:52:41 -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 m6MHoA9c001637; Tue, 22 Jul 2008 13:50:10 -0400 (EDT) To: Teodor Sigaev cc: Oleg Bartunov , Pgsql Hackers Subject: Re: [PATCHES] GIN improvements In-reply-to: <48861758.4070507@sigaev.ru> References: <483FD205.4090904@sigaev.ru> <486BC501.6060605@sigaev.ru> <27880.1215810535@sss.pgh.pa.us> <487A6E0C.3090600@sigaev.ru> <29437.1216742605@sss.pgh.pa.us> <48861758.4070507@sigaev.ru> Comments: In-reply-to Teodor Sigaev message dated "Tue, 22 Jul 2008 21:22:32 +0400" Date: Tue, 22 Jul 2008 13:50:10 -0400 Message-ID: <1636.1216749010@sss.pgh.pa.us> From: Tom Lane 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: 200807/1008 X-Sequence-Number: 121268 Teodor Sigaev writes: >> I started to look at this. I don't understand why VACUUM does an insert >> cleanup before starting to vacuum, but VACUUM FULL doesn't? > Hmm. May be I missed something, but I don't understand where and what... I tried > to track all places of ambultdelete call. aminsertcleanup should be called > before any ambulkdelete, because ambulkdelete doesn't scan pending list which > can store items to be deleted and hence index will store item pointers to absent > tuples. >> needed is the one at vacuum startup, which tempts me to propose that >> the new AM entry point should be called "amvacuumstartup", instead of >> wiring in the assumption that what it's for is specifically cleanup >> of insertions. > That's possible but inserts into index should be forbidden between > amvacuumstartup and last call of ambulkdelete. Well, if that is required to be true then this whole design is pretty broken, because VACUUM doesn't hold any lock that would guarantee that no insert happens between the two calls. If we fold the two AM calls into one call then it'd be okay for the index AM to take such a lock transiently during the single index-cleanup-plus-bulkdelete call. For VACUUM FULL there's no such issue because the whole table is locked, but I still don't see any real point in having two successive index AM calls when the AM could perfectly well do all the work in one call. Maybe it'd be better if ambulkdelete *did* scan the pending list? You'd still need at least page-level locking but perhaps not anything stronger. regards, tom lane