MySQL – Is It OK to Truncate These Tables?

enterprise-1.13logMySQL

I think the biggest table I am looking to clear is core_session, it is 500mb. Not sure about the logging event

This should be ok to truncate?enter image description here

Best Answer

core_session is being used to store sessions - this is a poor practice, rather use another distributed session store in multiserver setups to reduce load on the db (Redis, Memcached). If you truncate this table you will lose active sessions. Is it "safe"? Yes. Ill-advised, but safe.

enterprise_logging_event_changes controls the EE event log. If you need track-back on what took place in the admin panel I would not truncate this table. Safe, yes. I wouldn't do it though.

listrak_remarketing_session my guess here is yes - but it's a third party module and I would contact Listrak directly; I only have one client on Listrak and we never go about truncating tables. There's really no need to. Hard drive space is so cheap and I hate to futz with a working store installation.

Some thoughts

Truncating tables does not necessarily reclaim disk space. Innodb formatted tables increase the ibd files (even in file-per-table mode) and those files never shrink back down unless the db is wiped and reimported. The only thing you could possibly save is the size of a mysqldump later on.

I especially wouldn't be truncating tables to save a measly 29.30MB - tell your client to compress some images, that'll result in larger disk savings. If you're really that strapped for storage you may consider putting this box in the cloud where you can attach commodity devices at-will.