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 E958D3A41A6 for ; Wed, 24 Nov 2004 06:12:00 +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 29720-08 for ; Wed, 24 Nov 2004 06:11:50 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 91B963A42CF for ; Wed, 24 Nov 2004 06:11:49 +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 iAO6Bmw6004594; Wed, 24 Nov 2004 01:11:48 -0500 (EST) To: Jaime Casanova Cc: pgsql-performance@postgresql.org Subject: Re: Slow execution time when querying view with WHERE clause In-reply-to: <20041124054043.88464.qmail@web50002.mail.yahoo.com> References: <20041124054043.88464.qmail@web50002.mail.yahoo.com> Comments: In-reply-to Jaime Casanova message dated "Tue, 23 Nov 2004 23:40:43 -0600" Date: Wed, 24 Nov 2004 01:11:48 -0500 Message-ID: <4593.1101276708@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/362 X-Sequence-Number: 9316 Jaime Casanova writes: > Tom Lane wrote: >> Why is it so completely off about the selectivity >> of the IS NULL clause? > null values are not indexable, is that your question? Uh, no. The problem is that the IS NULL condition matched all 48 rows of the table, but the planner thought it would only match one row. This is definitely covered by the pg_stats statistics, and with only 48 live rows there couldn't possibly have been any sampling error, so what the heck went wrong there? regards, tom lane