OMFG Sessions!! Clear them out!!
Wednesday, January 14th, 2009So since my site, jamzee.com has been in production for over a year now, I have gotten ambitious and decided to do some database maintenance. The first thing I did was log into the server and run a:
mysqlcheck -o database -u username -p
This runs a bunch of mysql tasks; repair, optimize, etc. I notice this was taking a long time on one of the tables which happened to be the sessions table. I got suspicious and logged into the database for a peak.
What did I find, LOTS AND LOTS of rows, 150k+. This seemed relatively unnecessary so after some research found out that I can run the following:
rake db:sessions:clear
After some time of running that, we have a nice clear, and smaller database now! Next task is to throw that on a cron, probably run on a weekly interval.
Moral of the story, CLEAR THOSE SESSIONS!
