get_loop_count() fails to ignore RELOPT_DEADREL rels

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: get_loop_count() fails to ignore RELOPT_DEADREL rels
Date: 2014-07-26 09:11:46
Message-ID: CAApHDvp-Gid=8EpMOhxKhz7=m2FyseV25F9YhEVzy+OjtEq=ng@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I've just been hacking away a bit more at the WIP patch that I posted a
while back which allows join removals for SEMI and ANTI joins that could be
proved useless due to the existence of a foreign key which matched the join
condition (here
http://www.postgresql.org/message-id/CAApHDvq0NAi8cEqTNNdqG6mhFH__7_A6Tn9XU4V0cut9wab4gA@mail.gmail.com
)

On testing I found that the Assert(outer_rel->rows > 0) was failing in
get_loop_count(). The relation which it was failing on was one that I had
declared dead in remove_useless_joins(). I've not done very much work so
far in the costing part of the planner, however I see that set_rel_size()
seems to be in charge of dishing out row estimates in this case and that it
naturally does nothing for rels marked with RELOPT_DEADREL.

I've not yet determined if I can exploit this with the existing join
removal code, but I can give it a try if required.

In order to get my patch working with an Assert enabled build I've had to
apply the attached patch.

Regards

David Rowley

Attachment Content-Type Size
get_loop_count_ignore_dead_rels.patch application/octet-stream 618 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2014-07-26 09:19:34 Re: get_loop_count() fails to ignore RELOPT_DEADREL rels
Previous Message Andres Freund 2014-07-26 09:05:39 Re: parametric block size?