Re: Unions and where optimisation - Mailing list pgsql-performance

From Tomasz Myrta
Subject Re: Unions and where optimisation
Date
Msg-id 3E1C386B.5050400@klaster.net
Whole thread Raw
In response to Unions and where optimisation  (Boris Klug <boris.klug@control.de>)
List 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


pgsql-performance by date:

Previous
From: Tomasz Myrta
Date:
Subject: Re: Unions and where optimisation
Next
From: Boris Klug
Date:
Subject: Re: Unions and where optimisation