Urgent: Your [placeholder] database’s functionality is at risk

I’ve been getting these emails daily from DigitalOcean:

Our systems have indicated that your MySQL cluster, [placeholder], has tables without primary keys. We have identified that MySQL tables without primary keys can lead to service replication issues that jeopardize performance and availability. If primary keys are not present for database tables exceeding 5,000 rows, data-loss can occur.

We urge you to take the following actions to ensure that your database [placeholder] continues to operate correctly:

  1. Review the following product documentation which details the issue and provides clear mitigation strategies for all impacted users.
  2. Implement primary keys for all database tables as described in the documentation.

See the full details at the following link:

We will continue to notify you of this issue until all MySQL tables have primary keys.

I used the following SQL query to find tables without indexes:


I found a few tables that didn’t have primary keys, corrected the issue, and now the only remaining tables are:

  • performance_schema (lots of tables)
  • mysql (general_log and slow_log, which use the CSV engine)

I created a brand new database and did the same query on the new DB and the results on the new DB matched the results on the old DB. Like both queries returned 51 results.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

DigitalOcean support gave me this alternative query to run to find the problem tables:

    tab.table_schema AS database_name,
    tab.table_name AS table_name,
    tab.table_rows AS table_rows
FROM information_schema.tables tab
LEFT JOIN information_schema.table_constraints tco
    ON (tab.table_schema = tco.table_schema
        AND tab.table_name = tco.table_name
        AND tco.constraint_type = 'PRIMARY KEY')
    tab.table_schema NOT IN ('mysql', 'information_schema', 'performance_schema', 'sys')
    AND tco.constraint_type IS NULL
    AND tab.table_type = 'BASE TABLE';

It sound one table mine didn’t. The difference between mine and this one is that mine was looking at INFORMATION_SCHEMA.COLUMNS.COLUMN_KEY whereas this one is looking at INFORMATION_SCHEMA.TABLE_CONSTRAINTS.CONSTRAINT_NAME

Site Moderator
Site Moderator badge
May 11, 2022

Hi @jimwigginton,

From you’ve written, I think you’ve corrected the missing primary keys, is that correct? As such you shouldn’t be getting such messages already or are you still getting them?

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel
Get started for free

Enter your email to get $200 in credit for your first 60 days with DigitalOcean.

New accounts only. By submitting your email you agree to our Privacy Policy.

© 2023 DigitalOcean, LLC.