> On 14 Jun 2018, at 16:56, Nathan Bossart <bossa...@amazon.com> wrote:

> The v2 patches look good to me.  However, I found a couple other
> places where we might be able to use this micro-optimization.

Thanks a lot for your review!

> 1) dependencies_clauselist_selectivity() in dependencies.c
> 
>       /*
>        * If there's not at least two distinct attnums then reject the whole 
> list
>        * of clauses. We must return 1.0 so the calling function's selectivity 
> is
>        * unaffected.
>        */
>       if (bms_num_members(clauses_attnums) < 2)
>       {
>               pfree(list_attnums);
>               return 1.0;
>       }

I agree with this one, not sure why I missed that when grep’ing around while
writing the patch.  Fixed in the attached v3 patchset (which are now awkwardly
named but I didn’t change that).

> 2) BuildRelationExtStatistics() in extended_stats.c.
> 
>       /* check allowed number of dimensions */
>       Assert(bms_num_members(stat->columns) >= 2 &&
>                  bms_num_members(stat->columns) <= STATS_MAX_DIMENSIONS);

Since this usage is in an assertion I don’t see the value in changing it as the
current programming is more optimized for readability.

cheers ./daniel

Attachment: bms_num_members_comment-v3.patch
Description: Binary data

Attachment: postgres_fdw_bms_multiple-v3.patch
Description: Binary data

Reply via email to