Re: Unions and where optimisation

Поиск
Список
Период
Сортировка
От Tomasz Myrta
Тема Re: Unions and where optimisation
Дата
Msg-id 3E1C386B.5050400@klaster.net
обсуждение исходный текст
Ответ на Unions and where optimisation  (Boris Klug <boris.klug@control.de>)
Список 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 по дате отправления:

Предыдущее
От: Tomasz Myrta
Дата:
Сообщение: Re: Unions and where optimisation
Следующее
От: Boris Klug
Дата:
Сообщение: Re: Unions and where optimisation