Upgrading from Django 2.2 to Django 3.2 caused a severe performance degradation with MySQL 5.7 due to a bug introduced in Django 3.1.