X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2F6DB3A3FAE for ; Tue, 9 Nov 2004 23:24:40 +0000 (GMT) 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 15463-01 for ; Tue, 9 Nov 2004 23:24:36 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id CE1A23A3F9D for ; Tue, 9 Nov 2004 23:24:38 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iA9NOWZc006305; Tue, 9 Nov 2004 18:24:32 -0500 (EST) To: "Jim C. Nasby" Cc: pgsql-performance@postgresql.org Subject: Re: seqscan strikes again In-reply-to: <20041109222345.GG46084@decibel.org> References: <20041109222345.GG46084@decibel.org> Comments: In-reply-to "Jim C. Nasby" message dated "Tue, 09 Nov 2004 16:23:45 -0600" Date: Tue, 09 Nov 2004 18:24:32 -0500 Message-ID: <6304.1100042672@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/163 X-Sequence-Number: 9117 "Jim C. Nasby" writes: > I'm wondering if there's any way I can tweak things so that the estimate > for the query is more accurate (I have run analyze): > -> Index Scan using alert__tick_tsz on alert (cost=0.00..2498.49 rows=7119 width=28) (actual time=0.006..0.030 rows=12 loops=1413) > Index Cond: (("outer".prev_end_time < ms_t(alert.tick)) AND ("outer".end_time >= ms_t(alert.tick))) Can you alter the data representation? 7.4 doesn't have any stats about functional indexes and so it's not likely to come up with a good number about the selectivity of the index on ms_t(tick). It might be worth materializing that value as a plain column and indexing the column. (This being a join, I'm not sure it would help any, but it seems worth trying.) regards, tom lane