Re: Performance improvement for joins where outer side is unique - Mailing list pgsql-hackers

From David Rowley
Subject Re: Performance improvement for joins where outer side is unique
Date
Msg-id CAApHDvokK_WnMQRkJfWzso922vrevriZbX55PtD_KEfSfSn-cw@mail.gmail.com
Whole thread Raw
In response to Re: Performance improvement for joins where outer side is unique  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-hackers
On 26 February 2015 at 13:15, Tomas Vondra <tomas.vondra@2ndquadrant.com> wrote:

BTW, I find this coding (first cast, then check) rather strange:

    Var *var = (Var *) ecm->em_expr;

    if (!IsA(var, Var))
        continue; /* Ignore Consts */

It's probably harmless, but I find it confusing and I can't remember
seeing it elsewhere in the code (for example clausesel.c and such) use
this style:

    ... clause is (Node*) ...

    if (IsA(clause, Var))
    {
        Var *var = (Var*)clause;
        ...
    }

or

    Var * var = NULL;

    if (! IsA(clause, Var))
        // error / continue

    var = (Var*)clause;


Yeah, it does look a bit weird, but if you search the code for "IsA(var, Var)" you'll see it's nothing new.

Regards

David Rowley
 

pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Performance improvement for joins where outer side is unique
Next
From: David Rowley
Date:
Subject: Re: Combining Aggregates