X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 07BD69FB308 for ; Fri, 4 Aug 2006 23:15:37 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 58627-06 for ; Sat, 5 Aug 2006 02:15:29 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id A966E9FB2F3 for ; Fri, 4 Aug 2006 23:15:28 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k752FIB7024234; Fri, 4 Aug 2006 22:15:18 -0400 (EDT) To: Rusty Conover cc: pgsql-performance@postgresql.org Subject: Re: Query Plan - Bitmap Index Scan and Views In-reply-to: <26497C9E-3583-4EA2-A3AD-955F31E00CC3@infogears.com> References: <26497C9E-3583-4EA2-A3AD-955F31E00CC3@infogears.com> Comments: In-reply-to Rusty Conover message dated "Fri, 04 Aug 2006 16:37:55 -0600" Date: Fri, 04 Aug 2006 22:15:18 -0400 Message-ID: <24233.1154744118@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200608/59 X-Sequence-Number: 20244 Rusty Conover writes: > Is there any inherent benefit of using a the IN operator versus > joining a temporary table? Should they offer near equal performance? > It appears bitmap scan's aren't done when matching across a small > temporary table. I believe the problem you're facing is that existing PG releases don't know how to rearrange join order in the face of outer joins, and your view is full of outer joins. So the join against the temp table happens after forming the full output of the view, whereas you desperately need it to happen at the bottom of the join stack. CVS tip (8.2-to-be) has some ability to rearrange outer joins, and I'm interested to know whether it's smart enough to fix your problem. But you have not provided enough info to let someone else duplicate your test case. Would you be willing to download CVS or a recent nightly snapshot and see what it does with your problem? regards, tom lane