I have seen a lot of cases where a query was executed for each line in a table records or a list. This happens mostly because one of two things:
- A webblock with a query
- A function which contains a query
I think one of the most common causes is people using functions not knowing what that function does. So my suggestion would be to show a warning when an action is set as a function, but also contains queries. If a user is aware, the warning can be hidden.
It would be even better if a warning was shown each time a webblock or function was added in a list or table records that contains one or more queries. But I can imagine this being more complex.