Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 62ABF476B79 for ; Fri, 5 Jul 2002 13:49:01 -0400 (EDT) Mailbox-Line: From sszabo@megazone23.bigpanda.com Fri Jul 5 13:49:01 2002 Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id DF8E8475898 for ; Fri, 5 Jul 2002 12:15:21 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 35041D5F7; Fri, 5 Jul 2002 09:15:27 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 268985C03; Fri, 5 Jul 2002 09:15:27 -0700 (PDT) Date: Fri, 5 Jul 2002 09:15:27 -0700 (PDT) From: Stephan Szabo To: Gaetano Mendola Cc: Subject: Re: Union strange explain In-Reply-To: <005001c2240d$23d176e0$070afea9@GMENDOLA2> Message-ID: <20020705091034.W27508-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-3.5 required=5.0 tests=IN_REP_TO,X_NOT_PRESENT,NO_MX_FOR_FROM version=2.30 X-Spam-Level: X-Archive-Number: 200207/95 X-Sequence-Number: 4781 On Fri, 5 Jul 2002, Gaetano Mendola wrote: > Stephan wrote: > > number of rows returned). I think there was some question about > > whether it was safe to do that optimization (ie, > > is select * from (a union [all] b) where condition > > always the same as > > select * from a where condition union [all] > > select * from b where condition > > ) > > Yes but with a View the condition is always extern. > I'm understanding that I don't have any possibility to > optimize that view, I'm wrong ? Right now, I don't think there's much you can do using a view. Until we at least think we know what the safe conditions are to make that optimization, we can't do so since we might return incorrect results if the optimization is performed in a place it doesn't apply. If you want to do the legwork to show what (if any conditions) need to be met to do the optimization, we'd certainly be happy. :)