Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id A692A63276E for ; Mon, 9 Feb 2009 15:54:18 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 60883-06 for ; Mon, 9 Feb 2009 15:54:15 -0400 (AST) 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 mail.postgresql.org (Postfix) with ESMTP id 398CE632A17 for ; Mon, 9 Feb 2009 15:54:14 -0400 (AST) 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 n19Js5sl020442; Mon, 9 Feb 2009 14:54:05 -0500 (EST) To: Jeff Davis cc: Robert Haas , Teodor Sigaev , Heikki Linnakangas , Pgsql Hackers Subject: Re: [PATCHES] GIN improvements In-reply-to: <1233782589.3805.12.camel@dell.linuxdev.us.dell.com> References: <483FD205.4090904@sigaev.ru> <1232348905.7281.114.camel@jdavis> <4974B002.3040202@sigaev.ru> <1232474489.23316.8.camel@jdavis> <49770FD4.5030600@sigaev.ru> <1232561271.23793.46.camel@jdavis> <497864DC.5080800@sigaev.ru> <4979BAF8.1000501@sigaev.ru> <16080.1233625091@sss.pgh.pa.us> <1233772747.3805.2.camel@dell.linuxdev.us.dell.com> <603c8f070902041140h35c2aeo8c4ed79cd16400f8@mail.gmail.com> <1233782589.3805.12.camel@dell.linuxdev.us.dell.com> Comments: In-reply-to Jeff Davis message dated "Wed, 04 Feb 2009 13:23:09 -0800" Date: Mon, 09 Feb 2009 14:54:05 -0500 Message-ID: <20441.1234209245@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: 200902/451 X-Sequence-Number: 133741 Jeff Davis writes: > On Wed, 2009-02-04 at 14:40 -0500, Robert Haas wrote: >> Well, there's nothing to force that plan to be invalidated when the >> state of the pending list changes, is there? > Would it be unreasonable to invalidate cached plans during the pending > list cleanup? If the pending list cleanup is done by VACUUM then such an invalidation already happens (VACUUM forces it after updating pg_class.reltuples/ relpages). What's bothering me is the lack of any reasonable mechanism for invalidating plans in the other direction, ie when the list grows past the threshold where this code wants to turn off indexscans. Since the threshold depends on parameters that can vary across sessions, you'd more or less have to send a global invalidation after every addition to the list, in case that addition put it over the threshold in some other session's view. That's unreasonably often, in my book. Also, as mentioned earlier, I'm pretty down on the idea of a threshold where indexscans suddenly turn off entirely; that's not my idea of how the planner ought to work. But the real bottom line is: if autovacuum is working properly, it should clean up the index before the list ever gets to the point where it'd be sane to turn off indexscans. So I don't see why we need to hack the planner for this at all. If any hacking is needed, it should be in the direction of making sure autovacuum puts sufficient priority on this task. regards, tom lane