1

i have a wordpress blog and my shared hosting companny warned me about slow activity.

In my mysql slowlog.log i have essentialy queries that take about 2 an d 3 (i think seconds not milliseconds)

here is the query in the log :

# Query_time: 2  Lock_time: 0  Rows_sent: 25  Rows_examined: 36266
    SELECT l.ID, post_content, post_name, post_author, post_parent, post_modified_gmt, post_date, post_date_gmt
                    FROM (
                        SELECT ID FROM wp_posts 
                            WHERE post_status = 'publish'
                            AND post_password = ''
                            AND post_type = 'my_post_type'

                            ORDER BY post_modified ASC
                            LIMIT 25 OFFSET 9925 ) o
                        JOIN wp_posts l
                        ON l.ID = o.ID
                        ORDER BY l.ID;

My questions are : is this query a core query ? in this case is it normal to take 3 seconds ? if not, how can i remedy ? i mean by a core query if it is not a plugin or a theme function that generate this query, since i have not found it in the theme's function.php

I have another slow query in the log :

# Query_time: 2  Lock_time: 0  Rows_sent: 1  Rows_examined: 29232
SELECT post_modified_gmt FROM wp_posts WHERE post_status IN ('publish','inherit') AND post_type = 'my_post_type' ORDER BY post_modified_gmt ASC LIMIT 1 OFFSET 2999;

same questions here, is it a core query or plugin relatedd one etc...

Please note that i've installed WP super cache, my site loads faster but i still have these slow queries in slowlog.log

PS: I'm on a reliable hsting company (infomaniak), they have put my blog on Dedicated VPS machine for 15 days to let me fix the problem

Thanks for the help and sorry for my very bad english

-------------------------------------------EDIT---------------------------------------

No way still have these queries after installing wp super cache :(

# Query_time: 2  Lock_time: 0  Rows_sent: 25  Rows_examined: 49908
SELECT l.ID, post_content, post_name, post_author, post_parent, post_modified_gmt, post_date, post_date_gmt
                FROM (
                    SELECT ID FROM wp_posts 
                        WHERE post_status = 'publish'
                        AND post_password = ''
                        AND post_type = 'my_post_type'

                        ORDER BY post_modified ASC
                        LIMIT 25 OFFSET 23550 ) o
                    JOIN wp_posts l
                    ON l.ID = o.ID
                    ORDER BY l.ID;
Mokrane
  • 300
  • 3
  • 14
  • Who is your hosting company? Some cheap shared hosting can be horribly slow. I run 3 Wordpress sites from mine and they run fine. – Nigel B Apr 12 '13 at 09:53
  • I'm hosted on infomaniak it's very reliable, and they have put my all blog on dedicated (VPS) server for 15 days to let me fix the problem – Mokrane Apr 12 '13 at 10:02

3 Answers3

2

Okay i've found what was the problem for these queries :

First there are NOT CORE queries they were generated by a plugin which is called "Yoast WordPress SEO" precisally the sitemap part of the plugin. "file : class-sitemaps.php"

When i disabled the sitemap part of the plugin, i didn't had these queries in my slowlog.log file.

Mokrane
  • 300
  • 3
  • 14
0

This two queries are core queries, you can't remove it.

The best way is to use a cache plugin (like wp super cache),

hilflo
  • 1
  • 1
  • Thanks for your repply, as i've mentionned above, i've istalled and activated wp super cache but still have new entries in slowlog.log. Do you think that Query_time: 2 (2 seconds) is a normal time or is it suspicious ? – Mokrane Apr 12 '13 at 09:59
  • I think that the problem is that the query search in more than 36000 results (You have a lot of article). In fact, I'm not sure that is a core query cause of post_type = 'my_post_type'. Try to detect if you don't have a new WP_query somewhere in theme that filter post by custom post type – hilflo Apr 12 '13 at 10:15
  • True i've added 'my_post_type' in the query in the home page : $query->set('post_type', array('my_post_type')); But how can i do since i would like to show posts of type my_post_type in the home page. Can't wordpress handle 36000 custom post type articles ? :( – Mokrane Apr 12 '13 at 10:31
  • Wordpress can but your host, I don't know, It depend of your website traffic too. – hilflo Apr 12 '13 at 10:52
  • I think the question is : are 2 or 3 seconds for these queries a normal wordpress behavior on shared hosting? – Mokrane Apr 12 '13 at 11:03
  • No, it's too long for a query – hilflo Apr 12 '13 at 11:19
  • IT IS NOT A CORE QUERY FOR THE FIRST – Mokrane Apr 15 '13 at 17:04
  • THE SECONDE QUERY TOO IS NOT A CORE QUERY – Mokrane Apr 15 '13 at 17:12
0

I am getting this as slow query where this query will hit

SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish')  ORDER BY wp_posts.post_date DESC LIMIT 0, 10

actually i manually set posts_per_pages to 16,

naveena
  • 1
  • 1