Re: Unions and where optimisation

From: Tomasz Myrta <jasiek(at)klaster(dot)net>
To: Hannu Krosing <hannu(at)tm(dot)ee>
Cc: Boris Klug <boris(dot)klug(at)control(dot)de>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Unions and where optimisation
Date: 2003-01-08 14:32:11
Message-ID: 3E1C366B.5080406@klaster.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hannu Krosing wrote:

>
> try making the orderevents view like this:
>
> create view orderevents as
> select rk.aufnr, sub.ts
> from rk150 rk,
> ( select ts from rk150 where aufnr = rk.aufr
> union
> select ts from rk151 where aufnr = rk.aufr
> union
> select ts from rk152 where aufnr = rk.aufr
> ) as sub
> ;
>
> this could/should force your desired behavior.
>

Hannu, does it work?
Few months ago I lost some time trying to create this kind of query and
I always got error, that subselect doesn't knows anything about upper
(outer?) table.

In this query you should get error:
"relation rk does not exist".

What version of postgres do you have?
Tomasz Myrta

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Boris Klug 2003-01-08 14:36:33 Re: Unions and where optimisation
Previous Message Boris Klug 2003-01-08 13:25:48 Unions and where optimisation