Title: Performance Issue and possible solution
Last modified: October 14, 2019

---

# Performance Issue and possible solution

 *  Resolved [Darko G.](https://wordpress.org/support/users/darkog/)
 * (@darkog)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/performance-issue-and-possible-solution/)
 * Hello,
 * We found out using Query Monitor that your plugin is doing multiple SHOW TABLE
   queries and unfortunately it affects the performance on our sites by a lot.
 * Proof: [http://prntscr.com/pj03qj](http://prntscr.com/pj03qj)
 * I modified the function for you to implement in-memory object cache using wp_cache.*
   native WordPress functions to implement object cache and prevent multiple SQL
   queries during the page load:
 *     ```
       /**
        * Default Settings
        * @since 1.8
        * @version 1.0
        */
       public function get_log_table() {
   
       	global $wpdb;
   
       	if ( $this->is_multisite && $this->use_central_logging )
       		$wp_prefix = $wpdb->base_prefix;
       	else
       		$wp_prefix = $wpdb->prefix;
   
       	// Custom: Use object cache here
       	$table_name = wp_cache_get('mycred_log_table_name');
       	if( FALSE === $table_name ) {
       		$table_name = $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $wp_prefix . 'myCRED_log' ) );
       		if( $table_name !== NULL ) {
       			wp_cache_set('mycred_log_table_name', $table_name);
       		}
       	}
   
       	if( $table_name == NULL ) {
       		$table_name = $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $wp_prefix . 'mycred_log' ) );
       		if( $table_name == NULL ) {
       			$table_name = $wp_prefix . 'myCRED_log';
       		}
       		// Custom: Use object cache here
       		wp_cache_set('mycred_log_table_name', $table_name);
       	}
   
       	if ( defined( 'MYCRED_LOG_TABLE' ) )
       		$table_name = MYCRED_LOG_TABLE;
   
       	return $table_name;
   
       }
       ```
   
 * Please feel free to test and update the plugin. This will be beneficial to many
   other users striving for performance.
 * Best,
    Darko G
    -  This topic was modified 6 years, 7 months ago by [Darko G.](https://wordpress.org/support/users/darkog/).
    -  This topic was modified 6 years, 7 months ago by [Darko G.](https://wordpress.org/support/users/darkog/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [WPExperts.io](https://wordpress.org/support/users/wpexpertsio/)
 * (@wpexpertsio)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/performance-issue-and-possible-solution/#post-12031179)
 * Hi [@darkog](https://wordpress.org/support/users/darkog/),
 * Thanks for the help, I have forwarded the code to our development team. This 
   should be released in our next update if it goes through the QA.
 * Thank you.
 *  Thread Starter [Darko G.](https://wordpress.org/support/users/darkog/)
 * (@darkog)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/performance-issue-and-possible-solution/#post-12083181)
 * Hi, Any update?
 *  Plugin Author [WPExperts.io](https://wordpress.org/support/users/wpexpertsio/)
 * (@wpexpertsio)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/performance-issue-and-possible-solution/#post-12084261)
 * Hi [@darkog](https://wordpress.org/support/users/darkog/), our next update is
   still in progress, it should be released soon.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Performance Issue and possible solution’ is closed to new replies.

 * ![](https://ps.w.org/mycred/assets/icon-128x128.gif?rev=3512531)
 * [Points Management System For Gamification, Ranks, Badges, and Loyalty Rewards Program - myCred](https://wordpress.org/plugins/mycred/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mycred/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mycred/)
 * [Active Topics](https://wordpress.org/support/plugin/mycred/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mycred/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mycred/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [WPExperts.io](https://wordpress.org/support/users/wpexpertsio/)
 * Last activity: [6 years, 7 months ago](https://wordpress.org/support/topic/performance-issue-and-possible-solution/#post-12084261)
 * Status: resolved