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
- Create a post-deployment migration to add an index on
ci_runner_taggings.tag_name - Use
add_concurrent_indexto avoid locking the table - Consider whether this should be a standalone index or part of a composite index
- Analyze query patterns to determine the optimal index structure
Related Issues
- Parent: #467664
- Backfill: #570217 (closed)
Edited by Pedro Pombeiro