When I attempt to run a normal cleanup, the cleanup eventually loses connection to the database and dies. I think I am going to have to take the manual approach.
One thing that I wanted to point out is that I think you meant the SQL equivalent is: DELETE FROM django_session WHERE expire_date < '2010-01-01 1:23:45'; It should be less than, I believe. But that is very helpful, and I will need to use that to clean up the session table manually. On Aug 20, 8:44 pm, Russell Keith-Magee <russ...@keith-magee.com> wrote: > On Fri, Aug 20, 2010 at 11:51 PM, bfrederi <brfrederi...@gmail.com> wrote: > > I just wanted to know if anyone had an opinion or whether running a > > django-admin.py cleanup on 40 million session rows might slow down or > > lock up the database. I would like to do this cleanup ASAP, but I was > > concerned it might cause some issues. > > It depends entirely on your database. If you're using MySQL with > MyISAM tables, then almost certainly yes due to the table-level > locking. Other databases may be affected for different reasons. > > If you're trying to evaluate the risk, the cleanup command executes > the following: > > Session.objects.filter(expire_date__lt=datetime.datetime.now()).delete() > > Which is the SQL equivalent of: > > DELETE FROM django_session WHERE expire_date > '2010-01-01 1:23:45'; > > inside a the default transaction mode for your database. You'll have > to consult your database documentation to establish whether that will > pose a locking risk. > > Yours, > Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.