WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Number of Queries Being Run Discrepancy (3 posts)

  1. Dominic
    Member
    Posted 2 years ago #

    Since updating to version 3.3 RC1, it seems that my database queries have increased, but I can't be sure because I'm getting mixed messages.

    When I use <?php echo get_num_queries(); ?> it reports that it takes 45 queries to load my home page, definitely more than I would like. However, when I examine the queries using

    define( 'SAVEQUERIES', true );
    print_r( $wpdb->queries );

    I only see 18 queries listed which is about what I have come to expect. Does anyone know where this discrepancy is coming from and which one is correct?

  2. Brad Markle
    Member
    Posted 2 years ago #

    Hi dominicp, I don't have an direct answer for you, but I have developed a plugin that shows all of the queries that are running, and it also shows where at within the WordPress execution they are running. The plugin is called Memory Viewer, however it does much more then show your memory usage.

  3. Dominic
    Member
    Posted 2 years ago #

    Thanks for the tip Brad; I like you're plugin. It's showing 45 queries as well. By comparing it's output against define( 'SAVEQUERIES' ); it seems the discrepancy comes entirely from the queries that are ran in the plugins_loaded hook (i.e. those queries are not shown via define( 'SAVEQUERIES' );).

    It looks like a recent update of one of my plugins has caused it to go query crazy. I'll ask the plugin devs what happened. Thanks again.

Topic Closed

This topic has been closed to new replies.

About this Topic