#23830: Make expired session clearing on database backend scale better
-------------------------------------+-------------------------------------
Reporter: adamchainz | Owner:
Type: | adamchainz
Cleanup/optimization | Status: assigned
Component: contrib.sessions | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
Has patch: 1 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 1 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by iljamaas):
The patch is a partial improvement because it does not instantiate all the
objects. However using 'IN' query statements is not quite fast (to say it
nicely) in most DB's. As whereof I think it won't be faster in general.
(not tested though)
Actually in this specific case a 'DELETE FROM session WHERE expire_date
<'20XX-XX-XX' would deliver a huge performance boost, as the expire_date
field is DB indexed and it will not create a long running transaction in
which the records are deleted one by one.
So I would propose a solution which constructs a 'DELETE FROM.. WHERE'
statement and executes it.
--
Ticket URL: <https://code.djangoproject.com/ticket/23830#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.ed2637f3d12fe5633acf6404b381d4a8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.