Quantcast
Channel: phpBB.com
Viewing all articles
Browse latest Browse all 2802

[3.3.x] Support Forum • Re: [split] No new messages but unread messages

$
0
0
For anyone interested the phpbb_privmsgs table stores a single copy of a PM. The phpbb_privmsgs_to table stores recipient(s) and sender information. If both the sender and recipient(s) delete the message it's removed from the phpbb_privmsgs table.

Run this before running DELETE query, this will list entries in phpbb_privmsgs_to where no message exists in phpbb_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 the phpbb_privmsgs_to where no message exists just for your account(or any account by changing user_id):

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);
Assuming that solves issue for your account you can use this for everyone.

Code:

DELETE FROM phpbb_privmsgs_toWHERE NOT EXISTS (    SELECT 1    FROM phpbb_privmsgs    WHERE phpbb_privmsgs_to.msg_id = phpbb_privmsgs.msg_id);
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:
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



Viewing all articles
Browse latest Browse all 2802

Trending Articles