Issue with delete queries from last update
-
Hello,
After the last update, the website is generating continously the below queries and makes the website unresponsive(returning 504 or 502).
Query | 74 | Sending data | DELETE v1 FROM wp_statistics_visitor_relationships AS v1 INNER JOIN wp_statistics_visitor_relationships AS v2 WHERE v1.ID > v2.ID AND v1.visitor_id = v2.visitor_id AND v1.page_id = v2.page_id AND DATE(v1.date) = DATE(v2.date) /*route:master*/ | 73882 | 0 | 0 | Query | 46 | Sending data | DELETE v1 FROM wp_statistics_visitor_relationships AS v1 INNER JOIN wp_statistics_visitor_relationships AS v2 WHERE v1.ID > v2.ID AND v1.visitor_id = v2.visitor_id AND v1.page_id = v2.page_id AND DATE(v1.date) = DATE(v2.date) /*route:master*/ | 45473 |
They seem to come from this part of code:
public static function delete_duplicate_data() { global $wpdb; // Define the table name $table_name = DB::table('visitor_relationships'); // Start a transaction $wpdb->query('START TRANSACTION'); // Prepare the delete query with a self-join to identify and delete duplicates $delete_query = "DELETE v1 FROM {$table_name} AS v1 INNER JOIN {$table_name} AS v2 WHERE v1.ID > v2.ID AND v1.visitor_id = v2.visitor_id AND v1.page_id = v2.page_id AND DATE(v1.date) = DATE(v2.date)"; // Execute the delete query $wpdb->query($delete_query); // If no errors, commit the transaction $wpdb->query('COMMIT'); }
Here is as well the stack trace:
[13-Feb-2024 21:30:40] [pool www] pid 77764 script_filename = /app/web/wp-admin/admin-ajax.php [0x00007f9aa6a13990] mysqli_query() /app/web/wp-includes/class-wpdb.php:2349 [0x00007f9aa6a13920] _do_query() /app/web/wp-includes/class-wpdb.php:2263 [0x00007f9aa6a13840] query() /app/web/wp-content/plugins/wp-statistics/includes/class-wp-statistics-install.php:271 [0x00007f9aa6a13790] delete_duplicate_data() /app/web/wp-content/plugins/wp-statistics/includes/class-wp-statistics-install.php:552 [0x00007f9aa6a13620] plugin_upgrades() /app/web/wp-includes/class-wp-hook.php:324 [0x00007f9aa6a13540] apply_filters() /app/web/wp-includes/class-wp-hook.php:348 [0x00007f9aa6a134d0] do_action() /app/web/wp-includes/plugin.php:517 [0x00007f9aa6a133f0] do_action() /app/web/wp-settings.php:643 [0x00007f9aa6a13230] [INCLUDE_OR_EVAL]() /app/web/wp-config.php:200 [0x00007f9aa6a13170] [INCLUDE_OR_EVAL]() /app/web/wp-load.php:50 [0x00007f9aa6a130d0] [INCLUDE_OR_EVAL]() /app/web/wp-admin/admin-ajax.php:22
Please let me know if you need anything else.
Best regards,
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Issue with delete queries from last update’ is closed to new replies.