Missing index on expire_date in Session model
|Reported by:||joeri||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)
Changed 4 years ago by joeri
comment:1 Changed 4 years ago by SmileyChris
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Ready for checkin
comment:2 Changed 4 years ago by SmileyChris
- Needs documentation set
- Triage Stage changed from Ready for checkin to Accepted
- Version 1.2 deleted