Im trying to analyze queries of WordPress database of my website to look if there are speed lags performances.
I both used the php functions
<?php echo get_num_queries(); ?> queries in <?php timer_stop(1); ?> seconds
and it returns me this: 55 queries in 1,149 seconds
then i also analyzed the queries with a plugin: Debug Queries (http://bueltge.de/wordpress-performance-analysieren-plugin/558)
in this case it returns me this:
Total query time: 0,19168s for 56 queries.
Page generated in 1,00000s, 80,83% PHP, 19,17% MySQL
I want understand why there are so different result in terms of query analyzed, 55 first case and 56 in second, and so different time 1.149secs and the other 0.19168secs.
Thanks a lot.
P.S: i optimized database before.
For the speed difference, Debug Queries is recording only the query time — it adds up the time that the WordPress query engine records for each query.
timer_stop()
will include PHP execution time, IO, other stuff, as well as the query time. Debug Queries also seems to disable the MySQL cache, by the looks of it, but I’ve not investigated it too closely.As for the query difference, it could be that Debug Queries, as a plugin is hooking in/out a bit earlier or later than you are. The only way to be sure would be if you listed the queries you’re measuring like Debug Queries does and compared the lists.