Skip to:
Content
Pages
Categories
Search
Top
Bottom

get_option creates many DB queries per request / trac ticket 1550

  • @_az_

    Participant

    Hi,

    i was doing some performance analysis with the Xdebug and Xhprof profiling tools and noticed that many of my DB queries/per request are something similar to:

    SELECT option_value FROM wp_options WHERE option_name = '_bbp_enable_subscriptions' LIMIT 1

    In Trac Ticket 1550 it is mentioned, that the WordPress Object Cache is used, but this “error_log” (in wp-db.php Version 4.4.1 line 1809) tells me a different story:

    
    	private function _do_query( $query ) {
    		if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) {
    			$this->timer_start();
    		}
    
    		if ( $this->use_mysqli ) {
    			error_log($query . "\n", 3, '/tmp/wpdb.log');
    			$this->result = @mysqli_query( $this->dbh, $query );
    		} else {
    			$this->result = @mysql_query( $query, $this->dbh );
    		}
    		$this->num_queries++;
    
    		if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) {
    			$this->queries[] = array( $query, $this->timer_stop(), $this->get_caller() );
    		}
    	}

    Am i missing some Cache Settings here?

    I am using WordPress 4.4.1 with bbPress 2.5.8

Viewing 3 replies - 1 through 3 (of 3 total)
  • @_az_

    Participant

    Got it sorted out. Somehow my installation was missing the autoload column(?!) and by adding that i reduced the amount of queries.

    @netweb

    Keymaster

    I just read that #1550 ticket, last time I read it I think it made little to no sense 😉

    @_az_

    Participant

    Guess it is only an issue, when autoload is not working as expected.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar