Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 7834C4762EA for ; Wed, 22 Jan 2003 11:52:26 -0500 (EST) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id E6994476F5F for ; Wed, 22 Jan 2003 11:33:46 -0500 (EST) Received: from klaster.net (pe183.krakow.cvx.ppp.tpnet.pl [213.76.40.183]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id A946B2B862; Wed, 22 Jan 2003 17:29:31 +0100 (CET) Message-ID: <3E2EC4E9.7000809@klaster.net> Date: Wed, 22 Jan 2003 17:20:57 +0100 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.2b) Gecko/20021016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jan Wieck Cc: Ries van Twisk , pgsql-sql@postgresql.org Subject: Re: To use a VIEW or not to use a View..... References: <002001c2c228$bc3d2780$f100000a@IT001> <3E2EBCEE.EF487ECC@Yahoo.com> In-Reply-To: <002001c2c228$bc3d2780$f100000a@IT001> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/339 X-Sequence-Number: 11204 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 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