Re: Unions and where optimisation

From: Tomasz Myrta <jasiek(at)klaster(dot)net>
To: Boris Klug <boris(dot)klug(at)control(dot)de>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Unions and where optimisation
Date: 2003-01-08 14:40:43
Message-ID: 3E1C386B.5050400@klaster.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Michael Paesold 2003-01-08 15:48:27 Re: Unions and where optimisation
Previous Message Boris Klug 2003-01-08 14:36:33 Re: Unions and where optimisation