Conversation
supportUsing the latest version available of this plugin. On a large database with 18k rows in posts table, and 1.4 million in postmeta, this query was taking 1800+ seconds and getting killed by pt-kill. # Query_time: 1837.006869 Lock_time: 0.000001 Rows_sent: 0 Rows_examined: 1233843 SELECT DISTINCT(ID) FROM wp_posts INNER JOIN wp_postmeta as pm WHERE post_type="flamingo_inbound" AND ( TIMESTAMPDIFF(DAY, post_date, NOW()) ) >= 5 AND ( (pm.meta_key = "_submission_status" AND pm.meta_value ="spam") OR post_status="flamingo-spam" ) LIMIT 0, 10000; There doesn’t appear to be an ON clause describing how the two tables are joined. It looks like it needs this added: ON pm.post_id=wp_xbxhw9_posts.id This would appear to take the rows examined from billions to more in the 200k rows, and from 1800+ seconds to 1.12 seconds. Not sure this is the best code fix, but a potential fix is in file inazo-flamingo-automatically-delete-old-messages.php, line 171, add: ON pm.post_id = '.$wpdb->prefix.'posts.ID Let me know if you have further questions. I hope this can speed up other users of this plugin.
No comments were stored for this source.