Mysql – Slow performance when order by field in foreign key
When a queryset is sorted by a field in a related model performance decreases drastically. I use mysql. For example, I have two models: class Event(models.Model): idEvent = models.BigAutoField(primary_key=True) created_at = models.DateTimeField(db_index=True, verbose_name=_('date')) processed_at = models.DateTimeField(auto_now_add=True, verbose_name=_('processed')) data = models.TextField()…