How to speed up MySQL database?

Started by maxikk, Aug 05, 2022, 05:02 AM

Previous topic - Next topic

maxikkTopic starter


I have a WordPress website that is constantly being updated with new content. As a result, the MySQL database has grown significantly, causing the site to slow down and the pages to take a longer time to load. Despite trying to optimize, clean, and cache the site, the issue persists.

I am wondering if there is a way to allocate more resources to the database to help speed it up. I apologize in advance for any ignorance on my part, but I couldn't find anything helpful through Google. This is a new situation for me, so any assistance would be greatly appreciated.


1. It's safe to assume everything is working correctly if you have never accessed the PHP admin panel. The only exception might be an outdated version, which can be updated to a newer version for faster performance regardless of the database size.
2. Delve into the engine's admin panel; WordPress has some effective tools worth trying, including WP Optimize and WP Cleaner (backup recommended).
3. Other plugins and their settings may also be responsible; it's up to you to identify the culprit or hire a professional.

For further and safer steps:
1. Contact your hosting provider for assistance, and if necessary, enlist the help of a specialist. A reliable hosting provider will ensure that your websites are functioning as quickly and reliably as possible.
2. For personal servers, consider hiring a specialist to work on a permanent basis or educate yourself on progressive tools like MariaDB instead of using phpMyAdmin.

Additional options include accelerator tools like Redis at the server level. You can also reduce your database size by replacing the commenting system with an external one and importing existing comments to a different host.


To improve performance, it's important to utilize all standard database features, with proper index usage being crucial. Optimization of queries can be done incrementally by using the slow query log to identify areas in need of improvement.

Setting up MySQL with optimized parameters can have a significant impact on speed, and caching is a popular solution for further optimization. Internal caching can be achieved through MySQL's built-in cache, but external solutions like Memcache and Redis offer more flexibility.

While replication can improve load versatility, it shouldn't be solely relied upon for scaling under heavy load. Instead, it's best used as a backup mechanism for high availability purposes.

Sharding can be used to distribute data across different servers, with vertical sharding used to distribute tables across servers and horizontal sharding used to split large tables into smaller parts located on different servers. Complicated application logic may result, but sharding remains one of the most effective scaling mechanisms available.


There isn't one definitive solution to this issue, but there are several steps that can be taken to improve site performance.

Firstly, if the server response time exceeds 200 milliseconds, consider switching providers (e.g., using a Google PageSpeed test). Installing a caching plugin and using browser caching can also significantly improve website speed.

HTML, JavaScript, and CSS files should be optimized by removing unnecessary spaces, newlines, comments, and block markup. Enabling smart Gzip compression reduces the size of responses sent from the server to browsers.

Regularly deleting unnecessary data such as old post/page versions, drafts, moderated comments, trash pages, etc., can also help improve performance.

Finally, there are many other optimization techniques available, each with varying levels of effectiveness depending on your specific website's needs.