Update "Iterating tables in batches" docs
What does this MR do and why?
In !163461 (comment 2091976406) we noticed that batching query with LEFT JOIN is more than 2x more expensive than without. Since LEFT JOIN is not needed for the each_batch to identify id ranges, we can move LEFT JOIN to yielded relation to make the iteration less expensive.
Query plans
- https://console.postgres.ai/gitlab/gitlab-production-main/sessions/31179/commands/96840 vs https://console.postgres.ai/gitlab/gitlab-production-main/sessions/31265/commands/97069
- https://console.postgres.ai/gitlab/gitlab-production-main/sessions/31179/commands/96842 vs https://console.postgres.ai/gitlab/gitlab-production-main/sessions/31265/commands/97071
This MR updates an example in our docs of each_batch iteration with LEFT JOIN to suggest less expensive option.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
| Before | After |
|---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
Edited by Bogdan Denkovych