Skip to content

Add INDEX to Magento 2 tables?

My Sysadmin says there’s some space for optimization of DB by adding INDEX to some tables.

Namely:

catalog_product_entity
catalog_product_entity_varchar

Has anybody tried this before? Any guidance on how to achieve this?

I have not seen any articles on this.

I’m mostly a front-end DEV so this kind of stuff is new to me.

UPDATE:

I tested:

ALTER TABLE `catalog_product_entity_varchar` ADD INDEX `catalog_product_entity_varchar_id_index` (`value_id`)

It seems to have reduced the product page timing by about 0.26083159446725 on a local machine.

BEFORE: 0.82381319999695
AFTER: 0.56298160552979

Does anybody know what the effects of this are on general store management? Indexing, errors, and so on?

UPDATE:

Hmmm, it does not make any sense – the table already has indexed for each of the columns.

enter image description here

Going to retest with the backup of the DB.