I know it’s not the ideal solution, but had to do this, seem to be OK:
First, I retrieved all the IDs:
SELECT ID from wp_posts where post_name in (comma seperated slugs here)
Then updated posts, and deleted meta keys:
UPDATE wp_posts
SET post_status
= ‘publish’, post_name
= replace(post_name
,’__trashed’)
WHERE ID
in (comma delimited Ids);
DELETE FROM wp_postmeta
where post_id in (Ids here) AND meta_key in (‘_wp_trash_meta_status’,’_wp_trash_meta_time’)
Now, I am supposed to delete one more key and add another one, but I did not want to do an insert. These queries ran only few seconds for 600+ rows.