Missing index on expire_date in Session model
|Reported by:||Joeri Bekker||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||yes|
|Needs tests:||no||Patch needs improvement:||no|
We recently found that the Django session table, in a particular project setup, was not regularly cleaned. When we tried to do this manually (excluding recent entries), the select/delete action took like forever.
This was because there is no index defined on the "expire_date" field in the Session model and thus any action with a WHERE-clause on that field takes much longer than needed. Ruby had the same problem (long ago) and added an index on the expire_date field and I think Django should just do the same.
Kudos to Frodo from Medid for noticing this.
Change History (4)
comment:2 Changed 7 years ago by
|Triage Stage:||Ready for checkin → Accepted|