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 54F063A3F0E for ; Tue, 23 Nov 2004 17:54:24 +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 17070-02 for ; Tue, 23 Nov 2004 17:54:14 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id CC8ED3A3F81 for ; Tue, 23 Nov 2004 17:54:10 +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 iANHs6gu028238; Tue, 23 Nov 2004 12:54:06 -0500 (EST) To: Mike Mascari Cc: pgsql-performance@postgresql.org Subject: Re: Slow execution time when querying view with WHERE clause In-reply-to: <41A25C3B.3040608@mascari.com> References: <41A25C3B.3040608@mascari.com> Comments: In-reply-to Mike Mascari message dated "Mon, 22 Nov 2004 16:38:03 -0500" Date: Tue, 23 Nov 2004 12:54:05 -0500 Message-ID: <28237.1101232445@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/357 X-Sequence-Number: 9311 Mike Mascari writes: > When I query the view with a simple filter, I get: > explain analyze select * from p_areas where deactive is null; The problem seems to be here: > -> Seq Scan on _areas a (cost=0.00..2.48 rows=1 width=163) (actual time=0.037..0.804 rows=48 loops=1) > Filter: (deactive IS NULL) Why is it so completely off about the selectivity of the IS NULL clause? Are you sure you ANALYZEd this table recently? regards, tom lane