Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

newbie question - session size


Recommended Posts

I run a fairly decent size store and my database is getting to be pretty big. Upon looking at it, I noticed that the sessions table is over 100 megs! I'm told that that table stores session info like cart contents etc, but i find it hard to beleive that i need to allocate 100 megs to that.


I'm just curious what I can do to lower that size without compromising my customer experience?


Thanks in advance for your help.

Link to comment
Share on other sites

100 MB of data does sound pretty high for the sessions table. Are you sure it's 100 MB? Sessions tables should be cleaned up periodically. Unless your host has your webserver configured to have very long session lifetimes, or you really do have that much traffic, I'd be a little suspicious that cleanup doesn't seem to be happening.


Check in the database to see what the oldest session expiry time is:


select from_unixtime(expiry) from sessions order by expiry asc limit 1


If the day is today or even yesterday, then you're fine. If it's older, then you can manually clean out old sessions:


delete from sessions where expiry < unix_timestamp(now())



Discount Coupon Codes


Link to comment
Share on other sites

wow, that is gold. thanks alot. i've always been temped just to wipe it out. well atleast i did it with a bit more confidence. anyway, the select query you provided yeilded:



2005-05-02 19:57:48


That is quite an odd day. I'm not sure what that is (it's not the installation day of website), how do i change that so that it trails today by a few days or a week or so?

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...