[wp-trac] [WordPress Trac] #29942: wp_get_object_terms - no caching mechanism in place - results in duplicate queries
WordPress Trac
noreply at wordpress.org
Sun Oct 12 16:47:13 UTC 2014
#29942: wp_get_object_terms - no caching mechanism in place - results in duplicate
queries
-------------------------------+-----------------------------
Reporter: webgeekconsulting | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 4.0
Severity: normal | Keywords:
Focuses: performance |
-------------------------------+-----------------------------
wp_get_object_terms() isn't caching queries which results in duplicate
queries against the database. See the following debug info:
{{{
SELECT t.term_id FROM hf9v_terms AS t INNER JOIN hf9v_term_taxonomy AS tt
ON tt.term_id = t.term_id INNER JOIN hf9v_term_relationships AS tr ON
tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN
('product_category') AND tr.object_id IN (229) ORDER BY t.name ASC
include('wp-admin/edit-form-advanced.php'), do_meta_boxes, call_user_func,
post_categories_meta_box, wp_popular_terms_checklist, wp_get_object_terms
}}}
{{{
SELECT t.term_id FROM hf9v_terms AS t INNER JOIN hf9v_term_taxonomy AS tt
ON tt.term_id = t.term_id INNER JOIN hf9v_term_relationships AS tr ON
tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN
('product_category') AND tr.object_id IN (229) ORDER BY t.name ASC
include('wp-admin/edit-form-advanced.php'), do_meta_boxes, call_user_func,
post_categories_meta_box, wp_terms_checklist, wp_get_object_terms
}}}
I've attached a patch that creates a cache of the database query - similar
to what is being suggested in ticket #29894.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29942>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list