#34639: MySQL 8.0 hangs indefinitely when using the admin search with a Foreign Key and Annotate --------------------------------+-------------------------------------- Reporter: Nicolas Lupien | Owner: nobody Type: Bug | Status: new Component: contrib.admin | Version: 4.2 Severity: Normal | Resolution: Keywords: mysql | Triage Stage: Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 --------------------------------+-------------------------------------- Changes (by Nicolas Lupien):
* status: closed => new * resolution: invalid => Comment: It's definitely a Django issue. The query before #32682 is small instantaneous, and now, it crashes my db because it's astronomically costly, with only 500 rows. On production with 50,000 row, it costs 1.25e+15. This is, like @simon said, only because Django is not stripping unused annotations when using the root_queryset. The resulting query does a lot of unnecessary calculation. You can see it with all the debug information in my repository that I joined previously https://github.com/betaflag/django-sqlbugdemo -- Ticket URL: <https://code.djangoproject.com/ticket/34639#comment:6> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/010701889feb075b-4702c899-ea4d-42f8-9883-98dc87747366-000000%40eu-central-1.amazonses.com.