Insufficient memory to complete operation - Query revisiting criteria

Hi,
A few weeks ago we had some “Insufficient memory to complete operation” issues in 2 different query groups for the same db.

We’ve seen there is already a post in the forum asking for the same issue, and that the solution was to revisit the queries used. (Insufficient memory to complete operation)

Do you have some criteria that we can use to revisit our queries in light of our “Insufficient memory” issues?

The first thing our lead engineer did was to increase the query instances size, what increases memory… but we want to understand what is the root cause to prevent it to happen in the future…

Best,
Marc Sabates Gelpi