Good day, I am trying to fetch all of the queries being ran on every request with they're execution time.
It works on the AppServiceProvider.php using DB::listen. Apparently, the variable $time doesn't seem to match the execution time it provides when I run the query on my database, the one being provided by the DB::listen seems to be longer than what I have on my database execution.
Not really sure if I'm doing this the wrong way. I am using Laravel 5.4 btw.
You can use the barryvdh/laravel-debugbar package to see every query made on every page more easily.
Making a query directly into your database is often quite a bit faster than doing it through an ORM as @36864 said.
Yeah, that's true, but some of the result time are not realistic, like I have a log that indicated a 9.xs query which my application just executed like 1 or 2 sec.
@florianhusquinet , that's good if you'd like to see it thru browser. What I'm trying to achieve have it on a log and monitor queries that has long exec time. This is a way for me to see which query needs to be optimized.