Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 90F449FB359 for ; Tue, 3 Oct 2006 01:19:54 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 49614-10 for ; Tue, 3 Oct 2006 01:19:47 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id BCAB29FB2BF for ; Tue, 3 Oct 2006 01:19:47 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k934JdAN019402; Tue, 3 Oct 2006 00:19:39 -0400 (EDT) To: "Tim Truman" cc: "'Dave Dutcher'" , pgsql-performance@postgresql.org Subject: Re: Forcing the use of particular execution plans In-reply-to: <000001c6e6a0$5903b990$0340050a@sdg> References: <000001c6e6a0$5903b990$0340050a@sdg> Comments: In-reply-to "Tim Truman" message dated "Tue, 03 Oct 2006 13:29:37 +0930" Date: Tue, 03 Oct 2006 00:19:39 -0400 Message-ID: <19401.1159849179@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.094 tagged_above=0 required=5 tests=AWL, SPF_HELO_PASS, SPF_PASS X-Spam-Level: X-Archive-Number: 200610/21 X-Sequence-Number: 21150 "Tim Truman" writes: > Here is an "explain analyze" for the query that performs slowly, This shows that the planner is exactly correct in thinking that all the runtime is going into the seqscan on transaction: > "Aggregate (cost=88256.32..88256.32 rows=1 width=0) (actual > time=55829.000..55829.000 rows=1 loops=1)" > ... > " -> Seq Scan on "transaction" t > (cost=0.00..87061.04 rows=1630 width=349) (actual time=234.000..55797.000 > rows=200 loops=1)" > " Filter: ((transaction_date >= > '2005-01-01'::date) AND (transaction_date <= '2006-09-25'::date) AND > ((credit_card_no)::text ~~ '4564%549'::text))" Since that component of the plan was identical in your two original plans ("desired" and "undesired") it seems pretty clear that you have not correctly identified what your problem is. regards, tom lane