Opened 9 years ago

Closed 9 years ago

#11499 closed (invalid)

The default clean session will certainly not work with a huge session database

Reported by: Batiste Bieler Owned by: nobody
Component: Core (Management commands) Version: master
Severity: Keywords: cleanup, session
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:



I have a huge session table that is about 1 month old.
I have is gigabytes of session data. I really doubt that the default cleanup will work properly.
I have to admit I didn't try but if the script has to collect gigabytes of session it certainly not gonna work.

Here is the script I use instead :

What you guys think about that? Do you think it could make sense to integrate something like this instead of the default one or it's a bad idea?

Change History (5)

comment:1 Changed 9 years ago by JohnDoe

Resolution: invalid
Status: newclosed

Maybe you SHOULD have looked at the one in django-admin, because it is quite a bit more efficient than the one you got running there and is actually doing it the proper way.

What is does is just tell the database to delete any data older than expire_date instead of loading it all into python and parsing it like you're doing.

comment:2 Changed 9 years ago by Batiste Bieler

Thanks for the advice, I will give the default script a try.

comment:3 Changed 9 years ago by Batiste Bieler


So I tried to launch the command yesterday, and it's always running. The SQL command is extremely slow. Mysql InnoDB is extremely slow with comparison on no indexed value.

I have no solution with this. I can't really add an index on the date live. Even the script I presented seems to create strange lock issues. The only solution I see is to create a new table and switch to it or drop the old one...

comment:4 Changed 9 years ago by Batiste Bieler

Resolution: invalid
Status: closedreopened

Here is a "kind" of solution that seems to work well for me:

I don't like this script, but that seems to be the only thing that works for me.

comment:5 Changed 9 years ago by JohnDoe

milestone: 1.2
Resolution: invalid
Status: reopenedclosed

Just because you forgot to add an index, does not make it a bug or anything which should be fixed or changed.

If the pasted solution works for you, use it, but please, stop reopening this ticket as this is not a general problem.

Note: See TracTickets for help on using tickets.
Back to Top