Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 9ACAF1337B5A for ; Thu, 11 Nov 2010 14:58:57 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 05820-09 for ; Thu, 11 Nov 2010 18:58:50 +0000 (UTC) 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 0D5451336971 for ; Thu, 11 Nov 2010 14:58:49 -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 oABIwnBX019089; Thu, 11 Nov 2010 13:58:49 -0500 (EST) To: Robert Haas cc: Kevin Grittner , Mladen Gogala , "pgsql-performance@postgresql.org" Subject: Re: anti-join chosen even when slower than old plan In-reply-to: <18450.1289499783@sss.pgh.pa.us> References: <4CD9663502000025000374B1@gw.wicourts.gov> <20961.1289347680@sss.pgh.pa.us> <4CDA62C60200002500037512@gw.wicourts.gov> <4CDACBBF020000250003755B@gw.wicourts.gov> <4CDB7BAA.7020506@vmsinfo.com> <4CDBB0A40200002500037571@gw.wicourts.gov> <18450.1289499783@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Thu, 11 Nov 2010 13:23:03 -0500" Date: Thu, 11 Nov 2010 13:58:49 -0500 Message-ID: <19088.1289501929@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201011/159 X-Sequence-Number: 41183 I wrote: > I do think that something based around a settable-per-table caching > percentage might be a reasonable way to proceed. BTW ... on reflection it seems that this would *not* solve the use-case Kevin described at the start of this thread. What he's got AIUI is some large tables whose recent entries are well-cached, and a lot of queries that tend to hit that well-cached portion, plus a few queries that hit the whole table and so see largely-not-cached behavior. We can't represent that very well with a caching knob at the table level. Either a high or a low setting will be wrong for one set of queries or the other. It might work all right if he were to partition the table and then have a different caching value attached to the currently-latest partition, but that doesn't sound exactly maintenance-free either. Also, that only works with the current statically-planned approach to partitioned tables. I think where we're trying to go with partitioning is that the planner doesn't consider the individual partitions, but the executor just hits the right one at runtime --- so cost modifiers attached to individual partitions aren't going to work in that environment. The most practical solution for his case still seems to be to twiddle some GUC or other locally in the maintenance scripts that do the full-table-scan queries. Unfortunately we don't have an equivalent of per-session SET (much less SET LOCAL) for per-relation attributes. Not sure if we want to go there. regards, tom lane