As a Nextcloud developer, you probably know that since NC24, you can use the Profiler app in Nextcloud to help your performance investigations : GitHub - nextcloud/profiler: A built-in profiler UI for Nextcloud
There’s a very recent small enhancement in the last version of this tool, concerning SQL Queries usage, in PHP requests.
In addition to the list of requests “Database queries view”, you’ll find two new sections:
- Tables used :
Instead of searching through dozens of queries, this part group queries by their tables usage. So, you can find all queries concerning your table. These are sorted with
the cumulated time of the table usage.
- Similar queries
Similar SQL queries are grouped by similarity, and presented as “duplicates” if they are strictly the same.
First : when programming, you should consider similar queries as queries that could be grouped (eg IN (x,y,z) or where X or Y).
Second: Duplicates queries are - theorically - useless queries. This means that developers should track how and where this happen, and finally - especially with complex queries - use a PHP cache to avoid query redundancy.
If you do so, users and DB managers will certainly thank you!