Skip to content

VSD - Create index to support batching subgroups / projects

To efficiently batch over the namespaces table by a top-level namespace, selecting subgroups or projects we need to add a new index.

Index definition: ((traversal_ids[1]), type, id)

The index would support the following batching strategy:

Namespace.where('traversal_ids[1] = ?', namespace_id).where(type: 'Project').each_batch do |project_namespace_relation|
  # logic here
end