Julien Rouhaud <julien.rouhaud@dalibo.com> writes:
> I wonder if in remove_useless_groupby_columns(), in the foreach loop you
> could change the
> + if (bms_subset_compare(pkattnos, relattnos) == BMS_SUBSET1)
> + {
> by something like
> + if (bms_num_members(relattnos) <= bms_num_members(pkattnos))
> + continue;
> +
> + if (bms_is_subset(pkattnos, relattnos))
> + {
> which may be cheaper.
FWIW, I really doubt that would be cheaper. The various flavors of
subset comparison are word-at-a-time bitmasking operations, but
bms_num_members has to grovel over individual bits; it's certain to
be more expensive than a subset test.
regards, tom lane