Title: Performance
Last modified: August 22, 2016

---

# Performance

 *  [MikeNGarrett](https://wordpress.org/support/users/mikengarrett/)
 * (@mikengarrett)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/performance-9/)
 * This line makes me sad: $D = $wpdb->get_var(“SELECT COUNT(DISTINCT(relevanssi.
   doc)) FROM $relevanssi_table AS relevanssi”);
 * It would be awesome (since it’s just the number of unique entries in the db) 
   to save this number in the options table and update this when new entries to 
   that database are made. Running this on every search is not very performant.
 * I’m going to look into it. Hopefully I can submit a patch here.
 * [https://wordpress.org/plugins/relevanssi/](https://wordpress.org/plugins/relevanssi/)

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

 *  Thread Starter [MikeNGarrett](https://wordpress.org/support/users/mikengarrett/)
 * (@mikengarrett)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/performance-9/#post-5576629)
 * As a followup, I’ve been looking into where this table gets updated. It seems
   like we would need to be updating the tally in 2 different locations: the function
   relevanssi_remove_doc and the filter relevanssi_indexing_values in the relevanssi_index_doc
   function.
 *  Thread Starter [MikeNGarrett](https://wordpress.org/support/users/mikengarrett/)
 * (@mikengarrett)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/performance-9/#post-5576637)
 * I think I have a first draft ready. I need to continue testing it. I’ve added
   in a hook to the init and an update option when the index is finished building,
   so you’ll either have to rebuild the index or reactivate the plugin.
 * [http://the.digitalflan.com/Yxhq](http://the.digitalflan.com/Yxhq)
 *  Thread Starter [MikeNGarrett](https://wordpress.org/support/users/mikengarrett/)
 * (@mikengarrett)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/performance-9/#post-5576724)
 * A couple other fixes. This should do it.
 * [http://the.digitalflan.com/YyGN](http://the.digitalflan.com/YyGN)
 *  [Grimlock123](https://wordpress.org/support/users/grimlock123/)
 * (@grimlock123)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/performance-9/#post-5576725)
 * Thank you it helped me a lot
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/performance-9/#post-5576752)
 * Thanks, I’ll see about implementing these in the next version.
 *  Thread Starter [MikeNGarrett](https://wordpress.org/support/users/mikengarrett/)
 * (@mikengarrett)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/performance-9/#post-5576806)
 * Thank you, Mikko.
 * Sorry those patches are a bit messy. My editor automatically fixes strange spacing
   and line endings.

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

The topic ‘Performance’ is closed to new replies.

 * ![](https://ps.w.org/relevanssi/assets/icon-256x256.png?rev=3529670)
 * [Relevanssi - A Better Search](https://wordpress.org/plugins/relevanssi/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/relevanssi/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/relevanssi/)
 * [Active Topics](https://wordpress.org/support/plugin/relevanssi/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/relevanssi/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/relevanssi/reviews/)

## Tags

 * [count](https://wordpress.org/support/topic-tag/count/)
 * [performance](https://wordpress.org/support/topic-tag/performance/)

 * 6 replies
 * 3 participants
 * Last reply from: [MikeNGarrett](https://wordpress.org/support/users/mikengarrett/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/performance-9/#post-5576806)
 * Status: not a support question