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: