PrestaShop Database Crash at OVH: A Community Solved `PrestaShopDatabaseException`
A PrestaShop merchant faced a critical store outage, encountering a daunting PrestaShopDatabaseException error. The shop was inaccessible, displaying a database error message that hinted at a deeper underlying issue. This forum thread became a testament to community-driven problem-solving, guiding a non-specialist user through complex technical diagnostics to a successful resolution.
The Crisis: PrestaShopDatabaseException & OVH Overquota
The original post described a PrestaShop store that had "crashed" with a database exception, specifically a write refusal on the ps_guest table. The user, momofr, suspected database saturation at OVH. Community experts quickly confirmed this, identifying saturated MySQL quota or incorrect database user permissions as likely causes. This is a known issue with OVH's shared hosting plans.
Diagnosing Bloat & Outdated System
Upon gaining FTP access, momofr discovered the database was consuming 2.77 GB against a 2 GB limit. Investigation revealed two colossal tables responsible for the bloat: ps_connections (tracking user sessions) and ps_guest (guest activity). Together, these accounted for approximately 2.6 GB. The shop was also identified as running PrestaShop 1.6.1.10 on an outdated PHP 7.0. Database credentials for PrestaShop 1.6 are in config/settings.inc.php; for 1.7+, in app/config/parameters.php.
The Truncation Solution & OVH Support
To free up space, the recommended solution was to "truncate" these oversized tables. Truncating empties a table much faster than a DELETE command for large datasets. The following commands were applied:
TRUNCATE TABLE ps_connections;
TRUNCATE TABLE ps_connections_page;
TRUNCATE TABLE ps_connections_source;
TRUNCATE TABLE ps_guest;
TRUNCATE TABLE ps_pagenotfound;
Initially, momofr faced difficulties executing these commands, suspecting an OVH-imposed lock due to overquota. Community members advised contacting OVH support directly, requesting them to confirm/increase MySQL quota and verify automatic table locks. OVH's documentation explicitly addresses such SQL overquota issues.
Breakthrough: Quota Refresh and Full Recovery
After successfully running the TRUNCATE commands, the database size was significantly reduced to 1.4 GB. However, the shop remained offline. The crucial missing step, identified by the community, was to "Refresh the quota" within the OVH hosting panel. This action forces OVH's system to re-evaluate the database size and lift any restrictions. Once refreshed, the PrestaShop store came back online, with the database size plummeting to a healthy 57 MB.
Long-Term Recommendations: Migration & Maintenance
The incident highlighted critical long-term considerations: implementing regular database maintenance (e.g., clearing log tables, using optimization modules), migrating to a larger database plan (e.g., 4GB minimum) to prevent future overquota issues, and, most importantly, an urgent migration to a modern PrestaShop version (e.g., 8.x) and a compatible PHP version (8.x) for security and performance. This thread serves as an excellent guide for anyone facing similar PrestaShopDatabaseException errors, particularly those related to database saturation on shared hosting environments like OVH.