From: Tom Lane <tgl@sss.pgh.pa.us>
To: henk de wit <henk53602@hotmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Redundant sub query triggers slow nested loop left join
Date: Sat, 21 Apr 2007 19:48:08 -0400
Message-ID: <13922.1177199288@sss.pgh.pa.us> (raw)
In-Reply-To: <BAY106-F1923F1C1D05D94B1BAF671F5550@phx.gbl>
References: <BAY106-F1923F1C1D05D94B1BAF671F5550@phx.gbl>
"henk de wit" <henk53602@hotmail.com> writes:
> Naively I would say that a planner
> would have to be smart enough to see this by itself?
We got rid of direct tests for redundant WHERE clauses a long time ago
(in 7.4, according to some quick tests I just made). They took a lot
of cycles and almost never accomplished anything.
Since you have two redundant tests, the selectivity is being
double-counted, leading to a too-small rows estimate and a not very
appropriate choice of join plan.
FWIW, CVS HEAD does get rid of the duplicate conditions for the common
case of mergejoinable equality operators --- but it's not explicitly
looking for duplicate conditions, rather this is falling out of a new
method for making transitive equality deductions.
regards, tom lane
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-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, henk53602@hotmail.com
Subject: Re: Redundant sub query triggers slow nested loop left join
In-Reply-To: <13922.1177199288@sss.pgh.pa.us>
* 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