We have mobile application which communicates with our SF org via Rest API by executing thousands of different SOQL queries. There are usually three types of problems with such queries built dynamically by ios devs in their app:
- invalid syntax (missing brackets, spaces, not escaped quotes etc.)
- poor performance since queries are written not in an optimal way (e.g. 'where' condition is not relying on indexed fields etc.)
- wrong from business perspective (e.g. some type of users should not be querying some objects/records at all)
To catch all these types of problems at early stage we are looking for a solution to catch/monitor on SF side somehow all SOQL queries being executed in SF org (ideally filtered by source, e.g. internal vs REST api originated).
As of now we are doing some logging on mobile side and then migrating those records in SF custom object records. But this approach is a bit cumbersome and not quite reliable (again due to ios side being involved).
Is there any standard (out of the box) way to monitor SOQL queries performed? Or is there any idea of a good custom solution to be built for this? Any help would be appreciated.