Re: To use a VIEW or not to use a View.....

From: Tomasz Myrta <jasiek(at)klaster(dot)net>
To: Jan Wieck <JanWieck(at)Yahoo(dot)com>
Cc: Ries van Twisk <ries(at)jongert(dot)nl>, pgsql-sql(at)postgresql(dot)org
Subject: Re: To use a VIEW or not to use a View.....
Date: 2003-01-22 16:20:57
Message-ID: 3E2EC4E9.7000809@klaster.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Jan Wieck wrote:

>Use tables, views and views over views, it's all fine and your indexes
>will be used.

I can't agree with using views over views. It has some limitations.
I asked about it on this list several months ago
and Tom Lane's conclusion was:

>> Tomasz Myrta <jasiek(at)klaster(dot)net> writes:
>> I'd like to split queries into views, but I can't join them - planner
>> search all of records instead of using index. It works very slow.

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" :-(

regards, tom lane

I don't know if anything changed on 7.3.

Regards,
Tomasz Myrta

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2003-01-22 17:09:14 Re: To use a VIEW or not to use a View.....
Previous Message Stephan Szabo 2003-01-22 16:10:04 Re: To use a VIEW or not to use a View.....