Re: Small improvement to get_base_rel_indexes() - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Small improvement to get_base_rel_indexes()
Date
Msg-id 22140.1439665559@sss.pgh.pa.us
Whole thread Raw
In response to Small improvement to get_base_rel_indexes()  (David Rowley <david.rowley@2ndquadrant.com>)
List pgsql-hackers
David Rowley <david.rowley@2ndquadrant.com> writes:
> Attached is a small patch which improves the way get_base_rel_indexes()
> works.

> The current version creates a new bitmapset on each recursion level then
> bms_joins() to the one on the next level up each time. I understand that
> this will patch will have about a 0 net performance improvement, but I
> thought I'd post anyway as:

> 1. It removes 5 lines of code.
> 2. It's a better example to leave in the code.

I don't know that it's a better example: it seems substantially uglier.
(Notably, you complicated the API contract of get_base_rel_indexes()
without documenting the fact: it's now dependent on the original caller
to have initialized *result to NULL.)

We might have to use a method like this if the function were returning
multiple sets; but since it is not, the existing approach seems more
readable and safer to me.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Raising our compiler requirements for 9.6
Next
From: Jeff Janes
Date:
Subject: Potential GIN vacuum bug