Partitioning: Create async compound index for project_daily_statistics table

Backgroud

Related issue: Source Code: Table Cleanup: Partition project_d... (&18879 - closed)

The project_daily_statistics table stores daily aggregated metrics for GitLab projects. Due to the rapidly increasing table size, we decided to partition this table to improve performance and manageability.

This is the first step for partitioning the project_daily_statistics table. We need to create a compound index on date and id columns to facilitate efficient backfill operations during the partitioning process.

To-Do

Creates an async compound index on project_daily_statistics table using prepare_async_index to schedule index creation during weekend hours on GitLab.com.

Why is this needed?

The compound index on [:date, :id] is essential for:

  1. Efficient backfill queries during partitioning migration
  2. Supporting the 30-day backfill optimization

Resources

  1. Adding database indexes
  2. Create indexes asynchronously
  3. Partitioning
Edited Aug 12, 2025 by Emma Park
Assignee Loading
Time tracking Loading