[SQL] Optimize postmeta tables

With big data website with large number WooCommerce products, your website will lost time to process. It take long time to return your request.

After research and try to optimize many large store. I summary and give you this best instruction.

Optimize postmeta table

wp_postmeta stores any additional information which is connected to a post somehow especially user-defined. So, it not index that table correctly, it will affect to time for return data from MySQL.

We need to improve the index of that table.

Please open PHPMyAdmin, then go to the database of your website then run commands below. Replace the wp_ by your tables prefix before run script.

ALTER TABLE wp_postmeta ADD key(post_id, meta_key(100), meta_value(191));
ALTER TABLE wp_postmeta ADD key(meta_key(100), meta_value(191));

This script will takes some minutes to run. So, please be patient while command running.

Leave a Reply

Your email address will not be published. Required fields are marked *