Skip to content

Add index on ci_runner_taggings.tag_name column

Summary

Add an index on the ci_runner_taggings.tag_name column to optimize queries that filter or join by tag name.

Context

This is part of the work to handle FKs from ci_runner_taggings to tags as tracked in #467664.

The tag_name column was added and backfilled in 18.5. Adding an index will improve query performance when we transition away from joining to the tags table.

Implementation

  1. Create a post-deployment migration to add an index on ci_runner_taggings.tag_name
  2. Use add_concurrent_index to avoid locking the table
  3. Consider whether this should be a standalone index or part of a composite index
  4. Analyze query patterns to determine the optimal index structure

Related Issues

Edited by Pedro Pombeiro