2012
07.24
07.24
Today I’ve searched through MySQL slow query log, and found some intresting log entries, like this:
1 2 3 4 5 6 | # Time: 120724 12:10:12 # User@Host: user[db] @ localhost [] # Query_time: 1.539405 Lock_time: 0.000140 Rows_sent: 1 Rows_examined: 15162 use db; SET timestamp=1343124612; SELECT p.* FROM wp_posts AS p WHERE p.post_date < '2012-07-06 17:42:00' AND p.post_type = 'post' AND p.post_status = 'publish' ORDER BY p.post_date DESC LIMIT 1; |
So this one tiny query took 1.5 seconds? What is this? It is essential for my site?
When I dig a bit deeper into WordPress I’ve find out, that this query is generated in link-template.php by the get_adjacent_post function.
This creates the nice links in the header like:
1 2 | <link rel='next' title='Newest post' href='http://djzone.im/newest-post/' /> <link rel='prev' title='Oldest post' href='http://djzone.im/oldest-post/' /> |
Because we generate sitemaps regulary, this feature is useless for me.
So I’ve decided to turn this off, this way:
1 | remove_action('wp_head','adjacent_posts_rel_link_wp_head', 10, 0 ); |
No Comment.
Add Your Comment