pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomasz Myrta <jasiek@klaster.net>
To: Boris Klug <boris.klug@control.de>
Cc: pgsql-performance@postgresql.org
Subject: Re: Unions and where optimisation
Date: Wed, 08 Jan 2003 15:40:43 +0100
Message-ID: <3E1C386B.5050400@klaster.net> (raw)
In-Reply-To: <200301081425.48597.boris.klug@control.de>
References: <200301081425.48597.boris.klug@control.de>

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




view thread (8+ messages)  latest in thread

Message-ID: <3E1C386B.5050400@klaster.net>
Permalink:  ../3E1C386B.5050400@klaster.net/
Also on:    postgresql.org/message-id/3E1C386B.5050400@klaster.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: jasiek@klaster.net, boris.klug@control.de
  Subject: Re: Unions and where optimisation
  In-Reply-To: <3E1C386B.5050400@klaster.net>
  References: <200301081425.48597.boris.klug@control.de> <3E1C386B.5050400@klaster.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox