Optimizating with a DB profiler
One of the most common bottlenecks in an application is the querying to the database, as sometimes we just don't know how much is being queried, or we can't find out why something is going wrong. This recipe provides us with the tools to find even the smallest query used.
Getting ready
A database profiler is used to find bottlenecks in query performance and is a great tool to debug the queries that are executed in a session and of course the time it takes for them to execute. Once we develop bigger applications we tend to forget when and how certain pieces of code execute, which sometimes can lead to unnecessary complexity in our code.
How to do it…
Profiling an application's database usage can give a clear overview on the performance of our application, in this recipe we will discuss how to set up a simple profiler.
Setting up a new profiler
Setting up a new profiler is really easy as at the moment there is only one class in Zend Framework 2 that can be used as...