Solution: How to shrink or reduce the site of eZ Publish database backup dump files


I have a small site like a blog with only a few hundred entries. My mysql database backup dump files have grown in size upwards to over 1,000 MB! How can I reduce the size or amount of data stored in the eZ Publish Database?


Sadly the size is quite common. We have seen much larger sizes in the GB of exports of active clean eZ Publish installation databases. Suggest reading up on the flatten.php an cleanup.php php cli shell scripts as these should help you reduce some database size.

Suggested steps

- Empty the trash for all users

- Run flatten.php and cleanup.php scripts

- Remove session information from database

eZ Publish will store session information in the database and you may need to enable the php configuration setting, 'session.gc_probability' to purge the expired sessions.

PHP Sessions

Confirm these values in php.ini


eZ Publish Sessions

If you dump your database and review the file size and then review the contents you would find that the ezsession table often contains large amounts of session rows.


You can quickly truncate the ezsession table using sql thus freeing the table of records.



Or you may use the eZ Publish PHP CLI API (cleanup script) to free sessions in eZ Publish.