Core code caching issue w/ nav?
-
Hi,
Every time a page view occurs, wordpress is sending a complex non-ndexed query like
# Query_time: 0 Lock_time: 0 Rows_sent: 320 Rows_examined: 1608
SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (2366,2363,4066,…etc);I noticed this using log-queries-not-using-indexes in mysql.
The pertinent call stack is:
wp_get_nav_menu_items(3) in nav-menu.php (around line 495) calls
get_posts in post.php (around line 1461) calls
WP-Query->query in query.php (around line 2941) calls
WP-Query->get_posts in query.php (around line 2767) calls
update_post_caches in post.php (around line 4454) calls
update_postmeta_cache in post.php (around line 4474) calls
update_meta_cache in meta.php (around 560)
which makes the nasty SELECT statementThe SELECT statement is basically getting all the info from wp_postmeta for menu items whose post_id there has term_taxonomy_id = 3 in wp_term_relationships.
In other words, it’s getting some metadata corresponding to the menu bar.
But, why is the cache updated on every single page view? I have very little clue how the cache works (I’m starting to read about it) and that’s why I’m writing here. All I can say is that the “cache_results” is automatically turned on inside of the call to WP-Query->get_posts around line 1970. That’s great, but why might the cache get refreshed on every single page view?
What I want is to avoid that this complex SQL call is made on every single page view.
- The topic ‘Core code caching issue w/ nav?’ is closed to new replies.