152d919261
The OR conditions in the WHERE clause prevented the query from effectively filtering the messages related to the user quickly, this change helps gets around this by allowing the database to limit the rows in the messages table it needs to scan significantly.