Skip to content

Use bulk insert for workspace variables to reduce db queries

MR: Pending

Description

The following discussion from !147718 (merged) should be addressed:

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.]

Edited by Chad Woolley