Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 02F89636A03 for ; Sun, 30 Aug 2009 04:25:32 -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 43818-06 for ; Sun, 30 Aug 2009 07:25:17 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-gx0-f219.google.com (mail-gx0-f219.google.com [209.85.217.219]) by mail.postgresql.org (Postfix) with ESMTP id 3D8796321F5 for ; Sun, 30 Aug 2009 04:25:21 -0300 (ADT) Received: by gxk19 with SMTP id 19so4060939gxk.0 for ; Sun, 30 Aug 2009 00:25:20 -0700 (PDT) Received: by 10.90.211.6 with SMTP id j6mr2700300agg.86.1251613023187; Sat, 29 Aug 2009 23:17:03 -0700 (PDT) Received: from ?192.168.1.11? ([203.123.90.2]) by mx.google.com with ESMTPS id 3sm3620688aga.45.2009.08.29.23.16.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 29 Aug 2009 23:17:02 -0700 (PDT) Message-ID: <4A9A194D.9030101@bretth.com> Date: Sun, 30 Aug 2009 16:16:45 +1000 From: Brett Henderson User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Tom Lane CC: =?UTF-8?B?0JLRltGC0LDQu9GW0Lkg0KLQuNC80YfQuNGI0LjQvQ==?= , pgsql-jdbc@postgresql.org Subject: Re: Prepared Statement Query Planning References: <4A9892E5.4010509@bretth.com> <331e40660908282327y22c4e6d7wc4e6f69337d08a9f@mail.gmail.com> <4A98DDE4.4060509@bretth.com> <25520.1251557565@sss.pgh.pa.us> In-Reply-To: <25520.1251557565@sss.pgh.pa.us> Content-Type: multipart/alternative; boundary="------------020808080306080609040308" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.598 tagged_above=-10 required=5 tests=AWL=-0.000, BAYES_00=-2.599, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200908/88 X-Sequence-Number: 19937 This is a multi-part message in MIME format. --------------020808080306080609040308 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Tom Lane wrote: > 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...) > Thanks for the tip. I haven't tried the temp table queries yet. They're next. --------------020808080306080609040308 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit Tom Lane wrote:
Brett Henderson <brett@bretth.com> 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...)
  
Thanks for the tip.  I haven't tried the temp table queries yet.  They're next.

--------------020808080306080609040308--