From: Tomasz Myrta <jasiek@klaster.net>
To: Jan Wieck <JanWieck@Yahoo.com>
Cc: Ries van Twisk <ries@jongert.nl>
Cc: pgsql-sql@postgresql.org
Subject: Re: To use a VIEW or not to use a View.....
Date: Wed, 22 Jan 2003 17:20:57 +0100
Message-ID: <3E2EC4E9.7000809@klaster.net> (raw)
In-Reply-To: <002001c2c228$bc3d2780$f100000a@IT001>
References: <002001c2c228$bc3d2780$f100000a@IT001>
<3E2EBCEE.EF487ECC@Yahoo.com>
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@klaster.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jasiek@klaster.net, JanWieck@Yahoo.com, ries@jongert.nl
Subject: Re: To use a VIEW or not to use a View.....
In-Reply-To: <3E2EC4E9.7000809@klaster.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox