Title: refresh function dealcok
Last modified: June 21, 2019

---

# refresh function dealcok

 *  Resolved [Sociality](https://wordpress.org/support/users/sociality/)
 * (@sociality)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/refresh-function-dealcok/)
 * We use the plugin in a big db (100.000<posts) and we got deadlock in the sql 
   due to the refresh function of your plugin and particularly the query
 *     ```
           // Here's the optimization
                       $wpdb->query("SET @row_number = 0;");
                       $wpdb->query("UPDATE $wpdb->posts as pt JOIN (
                         SELECT ID, (@row_number:=@row_number + 1) AS <code>rank</code>
                         FROM $wpdb->posts
                         WHERE post_type = '$object' AND post_status IN ( 'publish', 'pending', 'draft', 'private', 'future' )
                         ORDER BY menu_order ASC
                       ) as pt2
                       ON pt.id = pt2.id
                       SET pt.menu_order = pt2.<code>rank</code>;");
       ```
   
 * I just commented out the action refresh for the admin hook. Is that OK? It seems
   that the plugin still works.

Viewing 1 replies (of 1 total)

 *  [Miha](https://wordpress.org/support/users/mplusb/)
 * (@mplusb)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/refresh-function-dealcok/#post-11667409)
 * Hello [@sociality](https://wordpress.org/support/users/sociality/),
 * Thank you for reaching out to us!
    Yes, removing that piece of code is ok. We
   only added it in the first because it was a suggestion from one of our users.
 * All the best,
    Mihaela

Viewing 1 replies (of 1 total)

The topic ‘refresh function dealcok’ is closed to new replies.

 * ![](https://ps.w.org/simple-custom-post-order/assets/icon-256x256.jpg?rev=2969435)
 * [Simple Custom Post Order](https://wordpress.org/plugins/simple-custom-post-order/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-custom-post-order/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-custom-post-order/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-custom-post-order/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-custom-post-order/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-custom-post-order/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Miha](https://wordpress.org/support/users/mplusb/)
 * Last activity: [6 years, 9 months ago](https://wordpress.org/support/topic/refresh-function-dealcok/#post-11667409)
 * Status: resolved