This PR revises the query that fetches the latest submission for each student-phase. Arguably we don't need this feature anymore, but given that it is still present I wanted to patch our memory overflow error:
ERROR 1038 (HY001): Out of sort memory, consider increasing server sort buffer size
I tried a lot of different ways to get the query to fallback on indexes, but the conclusion of my research was that indexes are hard.
This PR modifies the query to filter out all the submissions we don't care about before sorting. This technically doesn't fix the problem and mostly just moves the issue further down, but I'd be pretty surprised if we encounter it again, especially if intend on clearing the database each semester
What this does
This PR revises the query that fetches the latest submission for each student-phase. Arguably we don't need this feature anymore, but given that it is still present I wanted to patch our memory overflow error:
ERROR 1038 (HY001): Out of sort memory, consider increasing server sort buffer size
I tried a lot of different ways to get the query to fallback on indexes, but the conclusion of my research was that indexes are hard.
This PR modifies the query to filter out all the submissions we don't care about before sorting. This technically doesn't fix the problem and mostly just moves the issue further down, but I'd be pretty surprised if we encounter it again, especially if intend on clearing the database each semester