Title: Slow SQL requests
Last modified: September 25, 2023

---

# Slow SQL requests

 *  [hardoman](https://wordpress.org/support/users/hardoman/)
 * (@hardoman)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/slow-sql-requests-2/)
 * Hi! I use 3.1.3 plugin version with WP 5.6 and observe plugin slowness – it adds
   to to 2-3 seconds to the page load.
   With query monitor I found this is due to
   SQL requests in the function get_popular_posts()**SELECT** ID, post_title as 
   title, post_type, post_date, post_author, ttt.cntaccess as total_count, SUM(ttd.
   cntaccess) as daily_count**FROM** wp_top_ten **AS** ttt**INNER** **JOIN** wp_posts**
   ON** ttt.postnumber=ID**LEFT** **JOIN** (**SELECT** ***FROM** wp_top_ten_daily**
   AS** ttd**WHERE** **DATE**(ttd.dp_date) >= **DATE**(‘2023-09-25’)**AND** **DATE**(
   ttd.dp_date) <= **DATE**(‘2023-09-25’) ) **AS** ttd**ON** ttt.postnumber=ttd.
   postnumber**WHERE** 1=1**AND** ttt.blog_id = 1**AND** (wp_posts.post_status =‘
   publish’**OR** wp_posts.post_status = ‘inherit’)**AND** (wp_posts.post_type <
   > ‘revision’ )**GROUP** **BY** ID**ORDER** **BY** daily_count **DESC****LIMIT**
   0, 10I can also see that this function is called twice in page. WP Super Cache
   and Object cache are installed and object cache hit is around 99% but somehow
   this requets is out of it.Can this be optmized / fixed please?

Viewing 1 replies (of 1 total)

 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/slow-sql-requests-2/#post-17146539)
 * Hi [@hardoman](https://wordpress.org/support/users/hardoman/), sorry for the 
   delayed response. I missed this thread.
 * There are two issues I can see on this. One is that the daily table has grown
   quite large. Do you have the maintenance mode enabled? This removes entries older
   than 180 days from the daily table.
 * Another issue is that the indexes might be missing from the tables. You can try
   to regenerate this in the Tools page. I suggest backing up the database tables
   before making any changes.
 * Also, please turn on the plugin’s caching in case you haven’t done so already.
    -  This reply was modified 2 years, 7 months ago by [Ajay](https://wordpress.org/support/users/ajay/).

Viewing 1 replies (of 1 total)

The topic ‘Slow SQL requests’ is closed to new replies.

 * ![](https://ps.w.org/top-10/assets/icon-256x256.png?rev=2986432)
 * [WebberZone Top 10 — Popular Posts](https://wordpress.org/plugins/top-10/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/top-10/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/top-10/)
 * [Active Topics](https://wordpress.org/support/plugin/top-10/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/top-10/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/top-10/reviews/)

## Tags

 * [slowness](https://wordpress.org/support/topic-tag/slowness/)
 * [sql](https://wordpress.org/support/topic-tag/sql/)

 * 1 reply
 * 2 participants
 * Last reply from: [Ajay](https://wordpress.org/support/users/ajay/)
 * Last activity: [2 years, 7 months ago](https://wordpress.org/support/topic/slow-sql-requests-2/#post-17146539)
 * Status: not resolved