From d898694453014c2769582572c57c77bc352d105c Mon Sep 17 00:00:00 2001 From: Dylan Griffith <dyl.griffith@gmail.com> Date: Thu, 17 Oct 2024 21:07:24 +0000 Subject: [PATCH] Minor tweaks/links for batched_background_migrations.md This was a followup from https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169532#note_2164533996 --- doc/development/database/batched_background_migrations.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/development/database/batched_background_migrations.md b/doc/development/database/batched_background_migrations.md index 79a004988bd05..879e351696237 100644 --- a/doc/development/database/batched_background_migrations.md +++ b/doc/development/database/batched_background_migrations.md @@ -370,10 +370,11 @@ end #### Using a composite or partial index to iterate a subset of the table When applying additional filters, it is important to ensure they are properly -covered by an index to optimize `EachBatch` performance. +[covered by an index](iterating_tables_in_batches.md#example-2-iteration-with-filters) +to optimize `EachBatch` performance. In the below examples we need an index on `(type, id)` or `id WHERE type IS NULL` to support the filters. See -[the `EachBatch` documentation for more information](iterating_tables_in_batches.md). +the [`EachBatch` documentation](iterating_tables_in_batches.md) for more information. If you have a suitable index and you want to iterate only a subset of the table you can apply a `where` clause before the `each_batch` like: -- GitLab