Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id EA2B3476F6B for ; Wed, 8 Jan 2003 09:37:08 -0500 (EST) Received: from benhur.intern.control.de (unknown [217.89.112.10]) by postgresql.org (Postfix) with ESMTP id C0B12476F67 for ; Wed, 8 Jan 2003 09:37:07 -0500 (EST) Received: from devserver (devserver.intern.control.de [192.168.100.5]) by benhur.intern.control.de (8.12.6/8.12.6/Benhur 8.12.6) with ESMTP id h08Eb2VO024564; Wed, 8 Jan 2003 15:37:02 +0100 Content-Type: text/plain; charset="iso-8859-1" From: Boris Klug Organization: control IT GmbH To: Tomasz Myrta , Hannu Krosing Subject: Re: Unions and where optimisation Date: Wed, 8 Jan 2003 15:36:33 +0100 User-Agent: KMail/1.4.3 Cc: "pgsql-performance@postgresql.org" References: <200301081425.48597.boris.klug@control.de> <1042041735.3237.1.camel@huli> <3E1C366B.5080406@klaster.net> In-Reply-To: <3E1C366B.5080406@klaster.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200301081536.33211.boris.klug@control.de> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/57 X-Sequence-Number: 704 Hello! > Hannu, does it work? > Few months ago I lost some time trying to create this kind of query and > I always got error, that subselect doesn't knows anything about upper > (outer?) table. It does not work on my PostgreSQL 7.2.x Get the same error like you: "relation rk does not exist" Also the disadvantage of this solution is that the speed up is bound to=20 queries for the ordernr. If a statement has a where clause e.g. for a=20 timestamp, the view is still slow. Does PostgreSQL not know how to move where clause inside each select in a= =20 union? --=20 Dipl. Inform. Boris Klug, control IT GmbH, Germany