So I rant the first sql and got about 24 entries, ran the second and didn't get any for my user id, but ran the third sql anyway to clean up the 24 results I did get, and got this:For anyone interested thephpbb_privmsgstable stores a single copy of a PM. Thephpbb_privmsgs_totable stores recipient(s) and sender information. If both the sender and recipient(s) delete the message it's removed from thephpbb_privmsgstable.
Run this before running DELETE query, this will list entries inphpbb_privmsgs_towhere no message exists inphpbb_privmsgs. There shouldn't be many results for this. If you see hundreds I'd go back and compare backup table to new table.:Code:
SELECT * FROM phpbb_privmsgs_toWHERE NOT EXISTS ( SELECT 1 FROM phpbb_privmsgs WHERE phpbb_privmsgs_to.msg_id = phpbb_privmsgs.msg_id);
This will delete entries in thephpbb_privmsgs_towhere no message exists just for your account(or any account by changing user_id):Assuming that solves issue for your account you can use this for everyone.Code:
DELETE FROM phpbb_privmsgs_toWHERE user_id = 2AND NOT EXISTS ( SELECT 1 FROM phpbb_privmsgs WHERE phpbb_privmsgs_to.msg_id = phpbb_privmsgs.msg_id);Code:
DELETE FROM phpbb_privmsgs_toWHERE NOT EXISTS ( SELECT 1 FROM phpbb_privmsgs WHERE phpbb_privmsgs_to.msg_id = phpbb_privmsgs.msg_id);
1179781 rows deleted. (Query took 7.1073 seconds.)
Seemed to have deleted a lot, but my problem still persists.
Statistics: Posted by corleoner — Sun Jul 20, 2025 10:41 pm