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

Re: Trouble with LEFT JOIN using VIEWS.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Piotr Gasidło <quaker(at)barbara(dot)eu(dot)org>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Trouble with LEFT JOIN using VIEWS.
Date: 2007-12-07 15:36:04
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
=?ISO-8859-2?Q?Piotr_Gasid=B3o?= <quaker(at)barbara(dot)eu(dot)org> writes:
> I've just hit problem, that is unusual for me.

> View definition:
>   SELECT, users.user_name, users.extra IS NOT NULL AS has_extra
>     FROM users;

What you've got here is a non-nullable target list, which creates an
optimization fence when used in the nullable side of an outer join.
The problem is that has_extra should read as NULL in the query output
for a sites_secure row that has no match in users_secure_with_has_extra,
but making users.extra go to null will not make that happen, so there's
a constraint on where the expression can be evaluated.  The current
planner has no way to deal with that except by restricting the plan

We have some ideas about how to fix this, but don't hold your breath
... it's going to take major surgery on the planner, AFAICS.

			regards, tom lane

In response to

pgsql-performance by date

Next:From: Erik JonesDate: 2007-12-07 15:42:52
Subject: Re: Cost-Based Vacuum Delay tuning
Previous:From: Piotr GasidłoDate: 2007-12-07 10:55:08
Subject: Trouble with LEFT JOIN using VIEWS.

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