Skip to content

Commit 5092aae

Browse files
committed
Use bms_add_members() instead of bms_union() when possible
bms_union() causes a new set to be allocated. What this caller needs is members added to an existing set. bms_add_members() is the tool for that job. This is just a matter of fixing an inefficiency due to surplus memory allocations. No bugs being fixed. The only other place I found that might be valid to apply this change is in markNullableIfNeeded(), but I opted not to do that due to the risk to reward ratio not looking favorable. The risk being that there *could* be another pointer pointing to the Bitmapset. Author: David Rowley <[email protected]> Reviewed-by: Greg Burd <[email protected]> Reviewed-by: Tom Lane <[email protected]> Discussion: https://postgr.es/m/CAApHDvoCcoS-p5tZNJLTxFOKTYNjqVh7Dwf+5ikDUBwnvWftRw@mail.gmail.com
1 parent f8f4afe commit 5092aae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/optimizer/prep/prepunion.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ generate_union_paths(SetOperationStmt *op, PlannerInfo *root,
802802
linitial(rel->partial_pathlist));
803803
}
804804

805-
relids = bms_union(relids, rel->relids);
805+
relids = bms_add_members(relids, rel->relids);
806806
}
807807

808808
/* Build result relation. */

0 commit comments

Comments
 (0)