[wp-trac] [WordPress Trac] #24498: Improving performance of meta_form()
WordPress Trac
noreply at wordpress.org
Tue Jul 28 02:41:53 UTC 2015
#24498: Improving performance of meta_form()
----------------------------+--------------------------
Reporter: lumaraf | Owner: pento
Type: enhancement | Status: closed
Priority: normal | Milestone: 4.3
Component: Administration | Version: 3.5
Severity: normal | Resolution: fixed
Keywords: has-patch | Focuses: performance
----------------------------+--------------------------
Comment (by dd32):
After chatting with @chriscct7 however, there is another angle which we
could try here.
We could perform a query like this:
{{{
SELECT DISTINCT meta_key
FROM wp_postmeta pm
LEFT JOIN wp_posts p ON pm.post_id = p.id
WHERE p.post_type IN ( 'post', 'page', 'current-post-type-of-the-post')
AND meta_key NOT BETWEEN '_' AND '_z'
HAVING meta_key NOT LIKE '\_%'
ORDER BY meta_key DESC
}}}
I've not benchmarked it yet, but the idea is that plugins which add lots
of meta_keys probably do it on "hidden" data post_types rather than the
post_type that a user is actually editing. Since the user hasn't
consciously added the meta keys to those posts, they shouldn't be shown
here anyway.
If someone has a LOT of posts however (or only posts), this could
potentially be slower under the conditions.
If anyone has a site that fits either of those extremes (thousands of
meta_keys on non-post post_types - WooCommerce for example I believe) or a
site with many thousands of posts and can test that query out.. it'd be
appreciated :)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/24498#comment:29>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list