onaio / onadata

Collect, Analyze and Share
https://ona.io
Other
183 stars 132 forks source link

Tune migration performance #2631

Closed kelvin-muchiri closed 3 months ago

kelvin-muchiri commented 3 months ago

Changes implemented

Tune migration performance by disabling automatic creation of indexes by Django and updating the migration with SQL queries to create the indices concurrently. Indexes of interest were discovered by running the command python3.10 manage.py sqlmigrate logger 0018_entityhistory_entitylistgroupobjectpermission_and_more

Side effects of implementing this change

Migration runs faster in huge databases without locking transactions when the indexes are being created