Title: Log Size / Maintenance
Last modified: February 23, 2018

---

# Log Size / Maintenance

 *  Resolved [fullworks](https://wordpress.org/support/users/fullworks/)
 * (@fullworks)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/log-size-maintenance/)
 * On each page load, the plugin queries the log files, with now some 260,000 rows
   this query takes 5 seconds.
 * How are the logs meant to be trimmed? Is there a process or instruction?
 *     ```
       SELECT COUNT(*) 
       FROM wp_gamipress_logs AS p 
       LEFT JOIN wp_gamipress_logs_meta AS pm0
       ON ( p.log_id = pm0.log_id )
       LEFT JOIN wp_gamipress_logs_meta AS pm1
       ON ( p.log_id = pm1.log_id )
       LEFT JOIN wp_gamipress_logs_meta AS pm2
       ON ( p.log_id = pm2.log_id ) 
       WHERE p.user_id = '3' 
       AND ( ( p.type = 'event_trigger' )
       AND ( pm0.meta_key = '_gamipress_trigger_type'
       AND pm0.meta_value = 'gamipress_user_post_visit' )
       AND ( pm1.meta_key = '_gamipress_post_id'
       AND pm1.meta_value = '3483' )
       AND ( pm2.meta_key = '_gamipress_visitor_id'
       AND pm2.meta_value = '1' ) )	
       ```
   
 * Time 6.2470 seconds
    -  This topic was modified 8 years, 2 months ago by [fullworks](https://wordpress.org/support/users/fullworks/).

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

 *  Thread Starter [fullworks](https://wordpress.org/support/users/fullworks/)
 * (@fullworks)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/log-size-maintenance/#post-10010303)
 * p.s.
 * I don’t know why the query is needed or whythe logs and logs meta are needed,
 * but the performance hit comes from the ‘longtext’ of wp_gamipress_logs_meta.meta_key
   which can’t be indexed and hence table scans multiple times.
 * The maximum length in my instance of meta of 1.4 millions rows was 96 so I altered
   the column to varchar(255) and added an index and the query now takes milliseconds
   instead of6 seconds
 *  Thread Starter [fullworks](https://wordpress.org/support/users/fullworks/)
 * (@fullworks)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/log-size-maintenance/#post-10014916)
 * Any update on the logs, why are they so big? Can they be trimmed? Is the count
   really necessary on every page load?
 * Whilst indexing the table speeds things up a bit, this is still slow.
    -  This reply was modified 8 years, 2 months ago by [fullworks](https://wordpress.org/support/users/fullworks/).
 *  Plugin Author [Ruben Garcia](https://wordpress.org/support/users/rubengc/)
 * (@rubengc)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/log-size-maintenance/#post-10014968)
 * Hi [@fullworks](https://wordpress.org/support/users/fullworks/)
 * A speed performance suggestion is always welcome
 * We can not modify the gamipress_logs_meta structure basically because this table
   is intended to be used in the same way as WordPress postmeta and usermeta tables
   to store meta data related to the log
 * We are already working on improving this query and on next release you will see
   a substantial improvement on it
 * Thank you so much for your suggestion
 * Best regrads
 *  Thread Starter [fullworks](https://wordpress.org/support/users/fullworks/)
 * (@fullworks)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/log-size-maintenance/#post-10015040)
 * Can the logs and logs meta be trimmed? Why are they so massive? I’m not really
   familiar with the setting, I have been through them but it isn’t clear how to
   optimise?
 * Obviously a 6 second delay on every page load is massive and make the plugin 
   un usable right now. Even with the indexing it still takes 3 plus seconds
 * A straight count(*) without the meta joins takes milliseconds (i.e. is not a 
   server issue )
 * Alan
 *  Plugin Author [Ruben Garcia](https://wordpress.org/support/users/rubengc/)
 * (@rubengc)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/log-size-maintenance/#post-10021027)
 * Hi [@fullworks](https://wordpress.org/support/users/fullworks/)
 * Check the new GamiPress release (1.4.2)
 * It has an improvement on this function that reduces the time consumption to milliseconds(
   included on large databases)
 * I will mark this topic as resolved
 * Thank you so much for report it, we really appreciate this type of deep reports
   that let’s us improve GamiPress performance
 * Best regards

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

The topic ‘Log Size / Maintenance’ is closed to new replies.

 * ![](https://ps.w.org/gamipress/assets/icon-256x256.png?rev=1699714)
 * [GamiPress - Gamification plugin to reward points, achievements, badges & ranks in WordPress](https://wordpress.org/plugins/gamipress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gamipress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gamipress/)
 * [Active Topics](https://wordpress.org/support/plugin/gamipress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gamipress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gamipress/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Ruben Garcia](https://wordpress.org/support/users/rubengc/)
 * Last activity: [8 years, 2 months ago](https://wordpress.org/support/topic/log-size-maintenance/#post-10021027)
 * Status: resolved