Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id C580B632BC8 for ; Sat, 29 Aug 2009 11:53:00 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 98737-09 for ; Sat, 29 Aug 2009 14:52:40 +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 12ADA632A45 for ; Sat, 29 Aug 2009 11:52:49 -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 n7TEqj6b025521; Sat, 29 Aug 2009 10:52:45 -0400 (EDT) To: Brett Henderson cc: =?UTF-8?B?0JLRltGC0LDQu9GW0Lkg0KLQuNC80YfQuNGI0LjQvQ==?= , pgsql-jdbc@postgresql.org Subject: Re: Prepared Statement Query Planning In-reply-to: <4A98DDE4.4060509@bretth.com> References: <4A9892E5.4010509@bretth.com> <331e40660908282327y22c4e6d7wc4e6f69337d08a9f@mail.gmail.com> <4A98DDE4.4060509@bretth.com> Comments: In-reply-to Brett Henderson message dated "Sat, 29 Aug 2009 17:51:00 +1000" Date: Sat, 29 Aug 2009 10:52:45 -0400 Message-ID: <25520.1251557565@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.596 tagged_above=-10 required=5 tests=AWL=0.003, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/85 X-Sequence-Number: 19934 Brett Henderson writes: > However I don't think it will work in my case. I currently have three > different ways of selecting records, 1. by timestamp range (as in my > initial example), 2. by records in a temp table, and 3. unrestricted. > The unrestricted example isn't an issue because a full table scan is > appropriate in that case. However the temp table one is a different > matter. In the case of a temp table you have to ANALYZE the temp table after filling it; otherwise the planner is working completely blind as to what is in it. (autovacuum will not do this for you...) regards, tom lane