What to do if a query to a database is slow?
Sigiloso
First and foremost, I suggested investigating the core reason why the query is slow in the first place. This can be achieved with an explain API with many DB implementations. In case if the query was a critical GET request, I suggested adding an index for it. In other cases, the slowness of the query might not be a problem. In that case, programming efforts should be invested elsewhere.