Query Durations on loading time

Any Idea how to get the query durations on loading?

I tried this.

$connection = ConnectionManager::get(‘default’);
$connection->enableQueryLogging(true);
$data = $this->Statistics->find();
$connection = $connection->enableQueryLogging(true)->getCacher();
dd($connection);
return $this->response->withType(‘application/json’)
->withStringBody(json_encode([‘data’=>$data]));

Untitled

The problem is I dont know how to fetch the durations, and have no idea if this isaccurate. Thanks Guys :slight_smile:

On cake4. If I want to see the query-time, I will enable the query-logs in app.php, under Datasourceslog

From there, I can see the query time in the file logs/queries.log

example :

`

2023-07-17 10:35:06 Debug: connection=default duration=363 rows=1 SELECT Logs.id AS Logs__id, Logs.type AS Logs__type, Logs.authentication AS Logs__authentication, L…

`