[Koha-devel] Koha sessions table is ridiculously huge

Clay Fouts clay.fouts at liblime.com
Wed Feb 17 21:08:39 CET 2010


It depends, actually. For tables without FK constraints (like Koha's
"sessions"), truncation is instantaneous in MySQL.


On Wed, Feb 17, 2010 at 12:02 PM, Chris Cormack <chris at bigballofwax.co.nz>wrote:

> 2010/2/18 Clay Fouts <clay.fouts at liblime.com>:
> > You can also use "truncate sessions" to do the job if you just want to
> clear
> > out the contents of the table. It's faster and simpler than using
> mysqldump.
> >
> > This issue arises from the fact that the way Koha is written, if a user
> just
> > walks away from a session without logging out, their session data will
> hang
> > out in the the sessions table forever. A proper solution would involve
> > adding a timestamp column to the sessions table, enabling one to cull
> only
> > expired sessions entirely within SQL statements. With the current schema,
> > you'd have to parse the contents of each row within a user program, then
> > cull based on the expiry contained within the session data itself.
> > Cheers,
> > Clay
> >
> I suggested drop and recreate, because for a table that huge, truncate
> will take a lot lot longer.
> But as a cron job, definitely truncate, followed by optimize
>
> Chris
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/koha-devel/attachments/20100217/22b1a94e/attachment-0003.htm>


More information about the Koha-devel mailing list