MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
5 - Out of memory (Needed 2095500 bytes)
SELECT s.ip, s.uid, u.username, s.time, u.invisible, u.usergroup, u.usergroup, u.displaygroup FROM mybb_sessions s LEFT JOIN mybb_users u ON (s.uid=u.uid) WHERE s.time > '1537387339' AND location1='7' AND nopermission != 1 ORDER BY u.username ASC, s.time DESC