Queries
On this page
Queries
The Queries panel lists each SQL statement the request ran, with its datasource, duration, row count and parameters.

Detection
A query slower than thresholds.slowQueryMs (default 25 ms) warns. At 4 times the threshold it is critical.
The same SQL with placeholders run at least thresholds.nPlusOneMin times (default 3) is flagged as N+1.
With captureCaller, each query records the template and line that ran it.
The bar lists the queries and does not flag them. The console request detail lists slow and N+1 queries as issues.
Parameters
collectors.queries.includeParams controls whether Lens shows bound parameters. Values pass through redaction. The Copy SQL button copies the statement with its params filled in.
Example
This loop triggers the N+1 flag:
users = queryExecute( "SELECT id FROM users" );
for ( user in users ) {
queryExecute(
"SELECT * FROM orders WHERE user_id = :id",
{ id : user.id }
);
}
Fix it with one joined query or a single WHERE user_id IN (...).