Opened 14 years ago
Closed 14 years ago
#14231 closed (fixed)
Missing index on expire_date in Session model
Reported by: | Joeri Bekker | Owned by: | nobody |
---|---|---|---|
Component: | contrib.sessions | Version: | |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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.
Attachments (1)
Change History (4)
by , 14 years ago
Attachment: | django_session_index.patch added |
---|
comment:1 by , 14 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
comment:2 by , 14 years ago
Needs documentation: | set |
---|---|
Triage Stage: | Ready for checkin → Accepted |
Version: | 1.2 |
I don't know why I was saying that this should be kept out of trunk. It makes sense that it'd go in the standard release notes.
comment:3 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I'm going to push this straight to ready for checkin. It's valid and I've verified with Malcolm.
A new documentation file, kept out of trunk, needs to be created to track these types of things (but kept out of the sphinx build). I've added a new ticket #14258 to track that.