[X] I have checked the repository for duplicate issues.
What enhancement would you like to see?
Currently our SQL queries are horribly unoptimized. In an effort to simplify code readability, we opted to make many smaller queries rather than use optimized queries which may be less readable.
This has caused issues such as connections being locked up and taking multiple seconds to request all data, and n+1 queries for friends lists as found by @wolfendale. This should be changed as soon as possible.
Any other details to share? (OPTIONAL)
This issue only exists until a draft PR is made. We should do an overhaul of the entire database system in one PR to address these issues. Maybe we shouldn't raw-dog SQL anymore? I know ORMs and query builders can make queries more readable, but they also notoriously make bad SQL queries.
Checked Existing
What enhancement would you like to see?
Currently our SQL queries are horribly unoptimized. In an effort to simplify code readability, we opted to make many smaller queries rather than use optimized queries which may be less readable.
This has caused issues such as connections being locked up and taking multiple seconds to request all data, and n+1 queries for friends lists as found by @wolfendale. This should be changed as soon as possible.
Any other details to share? (OPTIONAL)
This issue only exists until a draft PR is made. We should do an overhaul of the entire database system in one PR to address these issues. Maybe we shouldn't raw-dog SQL anymore? I know ORMs and query builders can make queries more readable, but they also notoriously make bad SQL queries.