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

Re: Slow views

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: davidn-postgres(at)rebel(dot)net(dot)au, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Slow views
Date: 2004-07-17 04:04:40
Message-ID: 1305.1090037080@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> You also did an optimization, removing the subquery which PostgreSQL
> isn't.

I suspect the real issue is that the implied join order is not the same.
The view-based query is really

	a LEFT JOIN (b LEFT JOIN c LEFT JOIN d LEFT JOIN e)

while the allegedly equivalent hand expansion is

	a LEFT JOIN b LEFT JOIN c LEFT JOIN d LEFT JOIN e

and since JOIN associates left-to-right, this is not the same thing at
all.  I'm not even convinced that it gives the same end result ...
INNER JOIN is associative but LEFT JOIN is not.

			regards, tom lane

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2004-07-17 04:24:24
Subject: Re: Replace function BUG
Previous:From: Nishad PrakashDate: 2004-07-16 23:22:21
Subject: Cannot recreate DB scheme using pg_dump

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