Re: joining views

Поиск
Список
Период
Сортировка
От Tomasz Myrta
Тема Re: joining views
Дата
Msg-id 3DB6BA0A.4060502@klaster.net
обсуждение исходный текст
Ответ на joining views  (Tomasz Myrta <jasiek@klaster.net>)
Список pgsql-performance
Użytkownik Tom Lane napisał:

> I think this is the same issue that Stephan identified in his response
> to your other posting ("sub-select with aggregate").  When you write
>     FROM x join y using (col) WHERE x.col = const
> the WHERE-restriction is only applied to x.  I'm afraid you'll need
> to write
>     FROM x join y using (col) WHERE x.col = const AND y.col = const
> Ideally you should be able to write just
>     FROM x join y using (col) WHERE col = const
> but I think that will be taken the same as "x.col = const" :-(

I am sad, but you are right. Using views this way will look strange:

create view v3 as select
  v1.id as id1,
  v2.id as id2,
  ...
from some_view v1, another_view v2;

select * from v3 where
id1=1234 and id2=1234;

Is it possible to make it look better?

And how to pass param=const to subquery ("sub-select with aggregate") if
I want to create view with this query?
Tomasz Myrta


В списке pgsql-performance по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: joining views
Следующее
От: Terry Yapt
Дата:
Сообщение: Basic question about indexes/explain