Make WordPress Core

Opened 2 years ago

Last modified 2 months ago

#24498 closed enhancement

Improving performance of meta_form() — at Initial Version

Reported by: lumaraf Owned by:
Milestone: 4.3 Priority: normal
Severity: normal Version: 3.5
Component: Administration Keywords: has-patch
Focuses: performance Cc:


The query executed in meta_form() in wp-admin/includes/template.php took over 5 seconds to execute on my largest wordpress installation. I changed it to use a NOT BETWEEN to enable MySQL to execute the query by just using a small part of the meta_key index. My new query executes in less than 10 milliseconds.

Here is the improved query:
SELECT DISTINCT meta_key FROM wp_postmeta
WHERE meta_key NOT BETWEEN '_' AND '_z'
HAVING meta_key NOT LIKE '\_%'
ORDER BY meta_key

Change History (0)

Note: See TracTickets for help on using tickets.