Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 97E2F475FCE for ; Wed, 8 Jan 2003 09:36:55 -0500 (EST) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id EBA84475EB2 for ; Wed, 8 Jan 2003 09:36:54 -0500 (EST) Received: from klaster.net (ph110.krakow.cvx.ppp.tpnet.pl [217.99.208.110]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 13E2C2B21C; Wed, 8 Jan 2003 15:35:06 +0100 (CET) Message-ID: <3E1C386B.5050400@klaster.net> Date: Wed, 08 Jan 2003 15:40:43 +0100 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.2b) Gecko/20021016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Boris Klug Cc: pgsql-performance@postgresql.org Subject: Re: Unions and where optimisation References: <200301081425.48597.boris.klug@control.de> In-Reply-To: <200301081425.48597.boris.klug@control.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/56 X-Sequence-Number: 703 Boris Klug wrote: > create view orderevents as > select ts, aufnr from rk150 > union > select ts, aufnr from rk151 > union > select ts, aufnr from rk152; I lost some time and I didn't find valid solution for this kind of query :-( I solved it (nice to hear about better solution) using table inheritance. create table rk_master( fields... fields... ); create table rk150 () inherits rk_master; create table rk151 () inherits rk_master; create table rk152 () inherits rk_master; now you can just create simple view: select ts, aufnr from rk_master; Regards, Tomasz Myrta