X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 89D99D9744 for ; Sat, 1 Oct 2005 12:29:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70647-10 for ; Sat, 1 Oct 2005 15:29:08 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by svr1.postgresql.org (Postfix) with ESMTP id C95DED974A for ; Sat, 1 Oct 2005 12:29:08 -0300 (ADT) Received: by flake.decibel.org (Postfix, from userid 1001) id 542D31527C; Sat, 1 Oct 2005 10:29:07 -0500 (CDT) Date: Sat, 1 Oct 2005 10:29:07 -0500 From: "Jim C. Nasby" To: Sean Davis Cc: pgsql-general@postgresql.org Subject: Re: Query optimization Message-ID: <20051001152906.GY40138@pervasive.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 required=5 tests=[AWL=0.004] X-Spam-Level: X-Archive-Number: 200510/4 X-Sequence-Number: 84233 On Fri, Sep 30, 2005 at 06:24:52PM -0400, Sean Davis wrote: > -> Seq Scan on u_all_est_mrna c (cost=0.00..932582.74 rows=24225174 > width=179) (actual time=17.384..302484.904 rows=24225174 loops=1) That step is where most of your time is being spent, which isn't surprising given that it's scanning 24M rows. An index on abs(tend-tstart) might help eliminate that. It will also probably help if you increase the statistics_target for u_all_est_mrna, since it might be best to join before filtering on abs(tend-tstart), which is the opposite of what it's doing now. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461