Skip to content

Conversation

@moijes12
Copy link
Contributor

Add a composite index on Repository (url, active_status) to improve query performance for PushLoader.process(). The index is create CONCURRENTLY to avoid locking table during production deployment.

Some additional notes:

  • Migration uses CREATE INDEX CONCURRENTLY to avoid table locks
  • Index creation is atomic=False and safe to deploy during production traffic
  • Can be rolled back safely if needed via the reverse_sql in the migration

Testing Done:

  • Locally tested pytest tests/etl/test_push_loader.py -v and verified that no tests fail.
  • Also, checked that makemigrations works and that migrations can be applied successfully

Resolves: Bug-1361570

Add a composite index on Repository (url, active_status) to
improve query performance for PushLoader.process().
The index is create CONCURRENTLY to avoid locking table during
production deployment.

Resolves: Bug-1361570
Make migration update Django state and create index CONCURRENTLY (SeparateDatabaseAndState). This will fix the failing test.
Add a new line at the end of the migration file to fix the failing linter.
@moijes12
Copy link
Contributor Author

moijes12 commented Nov 15, 2025

@camd @jmaher

I have been able to add the required tests and fix them. I am facing an issue with formatting due to which I am not able to get the circleci job to create a build to work. Please can you tell me how I can fix this. All other CI jobs are working.

Update
I read through some documentation and understood how to correctly work with ruff. The code is now formatted correctly and all the ci jobs now pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant