From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: David Rowley <dgrowleyml@gmail.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: Performance improvement for joins where outer side is unique
Date: Thu, 26 Feb 2015 17:36:16 +0100
Message-ID: <54EF4B80.7020902@2ndquadrant.com> (raw)
In-Reply-To: <54EE659F.8050004@2ndquadrant.com>
References: <CAApHDvqF6Sw-TK98bW48TdtFJ+3a7D2mFyZ7++=D-RyPsL76gw@mail.gmail.com>
<CAApHDvod_uCMoUPovdpXbNkw50O14x3wwKoJmZLxkbBn71zdEg@mail.gmail.com>
<54EE659F.8050004@2ndquadrant.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
On 26.2.2015 01:15, Tomas Vondra wrote:
>
> I'm not quite sure why, but eclassjoin_is_unique_join() never actually
> jumps into this part (line ~400):
>
> if (relvar != NULL && candidaterelvar != NULL)
> {
> ...
> index_vars = lappend(index_vars, candidaterelvar);
> ...
> }
>
> so the index_vars is NIL. Not sure why, but I'm sure you'll spot the
> issue right away.
FWIW this apparently happens because the code only expect that
EquivalenceMembers only contain Var, but in this particular case that's
not the case - it contains RelabelType (because oprcode is regproc, and
needs to be relabeled to oid).
Adding this before the IsA(var, Var) check fixes the issue
if (IsA(var, RelabelType))
var = (Var*) ((RelabelType *) var)->arg;
but this makes the code even more confusing, because 'var' suggests it's
a Var node, but it's RelabelType node.
Also, specialjoin_is_unique_join() may have the same problem, but I've
been unable to come up with an example.
regards
--
Tomas Vondra http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
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-hackers@postgresql.org
Cc: tomas.vondra@2ndquadrant.com, dgrowleyml@gmail.com
Subject: Re: Performance improvement for joins where outer side is unique
In-Reply-To: <54EF4B80.7020902@2ndquadrant.com>
* 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