I'm looking to add a multi-column index to a postgres database. I have a non blocking SQL command to do this which looks like this:
CREATE INDEX CONCURRENTLY shop_product_fields_index ON shop_product (id, ...);
When I add db_index to my model and run the migration, will it also run concurrently or will it block writes? Is a concurrent migration possible in django?
There are AddIndexConcurrently
and RemoveIndexConcurrently
in Django 3.0:
Create a migration and then change migrations.AddIndex
to AddIndexConcurrently
. Import it from django.contrib.postgres.operations
.