Use bulk insert for workspace variables to reduce db queries
MR: Pending ## Description The following discussion from !147718 should be addressed: - [ ] https://gitlab.com/gitlab-org/gitlab/-/merge_requests/147718#note_1855198866: > I understand your perspective that this `each` loop that calls `save` has fixed and fairly limited size so performance impact is not that big, which definitely reduce urgency on that matter, yet still it is somewhat wasteful to execute 15 queries instead of one. > > I would like to suggest to create follow up issue to replace each loop with https://docs.gitlab.com/ee/development/database/insert_into_tables_in_batches.html, the fact that whole operation is wrapped with transaction on higher level and is considered as one batch suggest that it might be a good candidate to apply `#bulk_insert!` ## Acceptance Criteria TODO: Fill out (required) - [ ] [Describe what must be achieved to complete this issue.] - [ ] [Describe another requirement needed to complete this issue.] - [ ] [Add additional acceptance criteria as needed.] ## Technical Requirements TODO: Fill out or delete (optional) [If applicable, please list out any technical requirements for this feature/enhancement.] ## Design Requirements TODO: Fill out or delete (optional) [If applicable, please provide a link to the design specifications for this feature/enhancement.] ## Impact Assessment TODO: Fill out or delete (optional) [Please describe the impact this feature/enhancement will have on the user experience and/or the product as a whole.] ## User Story TODO: Fill out or delete (optional) [Provide a user story to illustrate the use case for this feature/enhancement. Include examples to help communicate the intended functionality.] <!-- Replace with other type, e.g. bug or maintenance, if appropriate --> <!-- Replace with other subtype if appropriate --> <!-- By default, all issues start in the unprioritized status. See https://about.gitlab.com/handbook/engineering/development/dev/create/ide/#-remote-development-planning-process --> <!-- For simplicity and to avoid triage bot warnings about missing workflow labels, we will default to issues starting at the refinement phase -->
issue