Make WordPress Core

Opened 2 years ago

Last modified 7 weeks ago

#24498 new enhancement

Improving performance of meta_form()

Reported by: lumaraf Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.5
Component: Administration Keywords: needs-patch
Focuses: performance Cc:

Description (last modified by SergeyBiryukov)

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 (4)

comment:1 @SergeyBiryukov2 years ago

  • Description modified (diff)

comment:2 @nacin17 months ago

  • Component changed from Performance to Administration
  • Focuses performance added

comment:3 @johnbillion7 weeks ago

#32361 was marked as a duplicate.

comment:4 @chriscct77 weeks ago

  • Keywords needs-patch added
  • Version changed from 3.5.1 to 3.5
Note: See TracTickets for help on using tickets.