Features

Avoid Expensive WP All Export meta_key Enumeration

Published · Last updated

When you edit an export in WP All Export, it tries to show you every custom field you could possibly include. To build that list it runs SELECT DISTINCT meta_key across the whole of wp_postmeta. On a small site that’s fine. On a large store wp_postmeta can hold tens of millions of rows, and asking MySQL for every distinct meta_key across a table that size means scanning an enormous amount of data. The result is an edit screen that takes an age to load, or times out entirely before you can get any work done.

The “Avoid expensive WP All Export meta_key enumeration” option stops that scan from crippling the edit screen, and it gives you two ways to handle it.

The first mode is prevent. In this mode the plugin returns a placeholder instead of running the scan at all, so the expensive query never happens. You type your meta keys in manually instead of picking them from a generated list. If you already know the field names you want, this is the fastest option because there’s no scan to wait for, ever.

The second mode is cache. Here the scan runs once, the resulting list of meta keys is cached, and every subsequent load of the edit screen is served from that cache rather than hitting wp_postmeta again. You still get the full pick list, you just only pay for it once instead of on every edit.

Note

Choose cache mode when you still want the full pick list, for example when you are not sure of the exact meta key names. You pay for the scan once on the first load; if new custom fields appear later, clear the cache so the fresh keys show up.

You’ll find this in the Imports tab under “Avoid expensive WP All Export meta_key enumeration”.

In short: WP All Export enumerates every meta_key in wp_postmeta when you edit an export, and on a large store that scan is painfully slow or times out. Prevent mode skips the scan and lets you type keys manually, cache mode runs it once and serves the list from cache afterwards. Either way the edit screen loads quickly again.

Further reading

the sister tool: finding and fixing slow WP All Import runs
index `wp_postmeta` so the queries around it stay fast at scale
the biggest single import speed win on a large catalogue

Comments

▲
▼
1/1