cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 database: Tables with out primary keys

Magento 2 database: Tables with out primary keys

I have deployed my database for Mangento 2 at Digital ocean. Almost every day, Digital Ocean sends me the email below.

 

Our systems have indicated that your MySQL cluster, 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.

 

Also, if I see this document. https://www.digitalocean.com/docs/databases/mysql/how-to/create-primary-keys/

I can see, there are few tables which don't have primary key. Is it okay to change the primary key of the tables?  Or any other solutions. Please let me know.

1 REPLY 1

Re: Magento 2 database: Tables with out primary keys

The primary key is a unique index that does not include null values.Before adding the primary key, you must ensure that the columns in the primary key column list are defined as NOT NULL. A primary key is a unique index and can be created only on not nullable columns.
To create primary key you can follow below link 
https://docs.digitalocean.com/products/databases/mysql/how-to/create-primary-keys/