Managed WordPress Help

How do I prevent MySQL concurrent connection limit issues?

Warning: Making changes to your WordPress site's database can break your site. All Managed WordPress plans have 30 days' worth of backups available by default. (I need to restore my database!)

Your Managed WordPress hosting plan has a limit on concurrent connections to the MySQL database that powers your WordPress site. When that limit is exceeded, it can interfere with the delivery and performance of your site's content.

It's rare for most sites to use more than a few concurrent connections at any one time. However, if your site has overhead (fragments left over from database changes), or a lot of comments due to spam, normal database queries will slow down. This can create a bottleneck that will clog your concurrent connections and cause an error establishing a database connection. This means your site will be unavailable and display an error until a concurrent connection is freed up for use.

There are some steps you can take to help prevent hitting the limit. Select a question to see its answer:

How do I remove comment spam?

Comments are an excellent way to provide your site's visitors with a place for discussion. Comments are enabled by default for posts and pages with enough options to build a community. Its ease of use, however, can cause spam to pile up and clog your database. This leads to sluggish queries that bottleneck your concurrent connections.

There are two methods for removing comment spam from your WordPress site, you can remove comments from the comments section in the WordPress dashboard, or you can remove comments in bulk through phpMyAdmin.

Be sure to optimize your database to clear the overhead after removing comment spam.

How do I know which tables are too large?

Tables grow over time through the normal operation of your WordPress site. In some situations, they can grow so large that they affect your performance and reliability. Whether it's due to revisions, comments, or a rogue plugin filling a table with log entries, the main indicator will be table size.

Here's how to find large tables in your database using phpMyAdmin:

  1. Sign in to phpMyAdmin
  2. In the left menu, select the database name.
  3. Under the Structure tab, select Size. This will sort the column in descending order. The largest tables should be on top (listed in MiB, KiB, and GiB). If not, select it again.
    Select the size column
  4. From the Table column, select the largest table name or Browse to access the table contents.

You'll need to be familiar with the contents of the table to understand what should stay and what needs to be removed. If the tables are WordPress core database tables, you can find documentation at WordPress.org. If the table is related to a specific plugin, you should review that plugin's documentation or reach out to the developer for help.

We have some paid-for options available if you need help with your database.

Be sure to optimize your database to clear the overhead after removing large parts of a table.

How do I clear the overhead?

Overhead is the temporary disk space your database uses to store queries. The longer your database operates, the more overhead will be created as your database goes through its normal operations. Think of overhead as fragmentation on a hard drive that eventually needs to be defragmented to restore performance.

Every database will eventually need some form of maintenance to keep it working properly. Cleaning up the fragmentation in MySQL is done through optimizing the database tables.

How do I prevent comment spam?

In addition to potential issues with concurrent database connections, comment spam can quickly become damaging to your sites' credibility and reputation if left unchecked. Along with all the options in WordPress that allow discussion in comments to build a community, there are a host of options available to prevent spam.

Some of the best ways to prevent spam include changing the comment approval settings, who is allowed to comment, creating comment blocklists, disabling comments on old pages or posts, and if you don't want any comments at all; disable comments all together. Find out more about preventing WordPress comment spam.

More info

Share this article