Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 3DAA42E0068 for ; Fri, 4 Apr 2008 02:49:38 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 20253-03-8 for ; Fri, 4 Apr 2008 02:49:33 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by developer.postgresql.org (Postfix) with ESMTP id DEAE12E009A for ; Fri, 4 Apr 2008 02:49:29 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m345nRVN004768; Fri, 4 Apr 2008 01:49:28 -0400 (EDT) To: "Matt Klinker" cc: pgsql-performance@postgresql.org Subject: Re: Query plan excluding index on view In-reply-to: <3bda20f60804032158u4f6765e3t8b0debad3e7f5ceb@mail.gmail.com> References: <3bda20f60804031631j177b42e2u82b5033fd23c2293@mail.gmail.com> <28177.1207266621@sss.pgh.pa.us> <3bda20f60804031654q7991de08m1254964511632acf@mail.gmail.com> <29828.1207271948@sss.pgh.pa.us> <3bda20f60804032158u4f6765e3t8b0debad3e7f5ceb@mail.gmail.com> Comments: In-reply-to "Matt Klinker" message dated "Thu, 03 Apr 2008 22:58:10 -0600" Date: Fri, 04 Apr 2008 01:49:27 -0400 Message-ID: <4767.1207288167@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/41 X-Sequence-Number: 29534 "Matt Klinker" writes: > Sorry for not including this extra bit originally. Below is the explain > detail from both the query to the view that takes longer and then the query > directly to the single table that performs quickly. ... > -> Subquery Scan *SELECT* 1 (cost=0.00..1285922.80 rows=18384890 > width=251) > -> Seq Scan on company (cost=0.00..1102073.90 rows=18384890 The presence of a Subquery Scan node tells me that either this is a much older PG version than you stated, or there are some interesting details to the query that you omitted. Please drop the fan-dance routine and show us a complete reproducible test case. regards, tom lane