Re: get_loop_count() fails to ignore RELOPT_DEADREL rels

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: get_loop_count() fails to ignore RELOPT_DEADREL rels
Date: 2014-07-27 12:00:51
Message-ID: CAApHDvo5wCRk7uHBuMHJaDpbW-b_oGKQOuisCZzHC25=H3__fA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jul 27, 2014 at 2:35 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> David Rowley <dgrowleyml(at)gmail(dot)com> writes:
> > In order to get my patch working with an Assert enabled build I've had to
> > apply the attached patch.
>
> That patch is entirely bogus. What you should be asking is why
> get_loop_count is being applied to a relation that's supposedly been
> removed from the query. It should only get applied to rels that are
> required outer rels for a parameterized path, and thus certainly
> not dead.
>
>
hmm ok. After further investigation it seems that this is down to the
EquivalenceClass still containing references to the dead rel. What seems to
be happening is match_eclass_clauses_to_index() is calling
generate_implied_equalities_for_column() which is generating RestrictInfo
clauses which make reference to the dead relation.

With the existing left join removal code, in all the test cases I've thrown
at it, match_eclass_clauses_to_index() seems to early exit on if
(!index->rel->has_eclass_joins), but this is not the case when I'm removing
SEMI and ANTI joins. So likely this is something I'll have to tackle in
that patch, perhaps by stripping out the equivalence class members which
belong to the newly dead rel in remove_rel_from_query().

Apologies for the noise

Regards

David Rowley

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message 李海龙 2014-07-27 12:21:56 Re: 9.4 pg_control corruption
Previous Message Peter Geoghegan 2014-07-27 07:00:38 Re: B-Tree support function number 3 (strxfrm() optimization)