Skip site navigation (1) Skip section navigation (2)

Re: joining views

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tomasz Myrta <jasiek(at)klaster(dot)net>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: joining views
Date: 2002-10-23 14:31:18
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
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

In response to


pgsql-performance by date

Next:From: Tomasz MyrtaDate: 2002-10-23 15:02:34
Subject: Re: joining views
Previous:From: Tomasz MyrtaDate: 2002-10-23 07:53:10
Subject: joining views

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group