Debugging queries? (best practices)

What are the recommended ways of debugging queries in the controllers?

Also, how can we benchmark queries to identify performance issues?

Thanks

Hi
Set queries to true in your config.
It should also tell you the query time.
(Edit:see here for more detail https://learn.userfrosting.com/troubleshooting/debugging#query-debugging)

1 Like

Yep! Please note that query logging will only work for successful queries. For queries that fail, you should end up seeing the raw SQL error message in the HTTP response (in development mode only, of course).

You can also use toSql to get the raw query generated by Builder before you actually run it (using get(), for example).

1 Like