After switching to MariaDB, I saw an issue where fetchMessageInfos was returning the oldest messages rather than the newest ones.
It was happening because nested queries in MariaDB 10.7 seem to drop the order of the rows. I first tried simply adding an additional ORDER BY clause to the outer query, but found that didn't work because the SQL quirky counting logic we use gets processed before the ORDER BY. (Which is in fact the reason for the nested query.)
I did some Googling and found this. It turns out adding any LIMIT will force MariaDB to preserve the order.
Depends on D4499