CntoDev / django-roster

Web-based roster for tracking members and their attendance implemented in Django.
4 stars 3 forks source link

SQL query optimisation passes #92

Closed lastmikoi closed 6 years ago

lastmikoi commented 6 years ago

Hello,

I'm gradually dipping back in the RBAC feature project and I had the opportunity of being slowed down to a crawl when using the django debug toolbar.

After a bit of troubleshooting and resolution, turned out it was mainly a query optimisation issue.

Here are the changes and their results, they shouldn't change any feature just make stuff faster, did a tiny bit of refactoring but should be minor.

As far as results are concerned:

/manage: Before 915 queries with the current production database, down to 202 queries (couldn't easily optimise absences and contribution types without changing the schema) /event-browser: Before a whopping 6183 queries with the current production database, down to 6 queries :smile: