id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 14231 Missing index on expire_date in Session model Joeri Bekker nobody "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." closed contrib.sessions fixed Accepted 1 1 0 0 0 0