Keep an Eye on Your Entities

By Jérôme Vieilledent, on Dec 10, 2020

Available on any of our paid subscriptions, the Database Dimension of a profile gives you an overview of all the SQL queries performed by your application, by providing key information:

  • The total number of SQL queries;
  • Time spent during the database connection;
  • Time spent triggering the queries, and waiting for their result;
  • The (anonymized) SQL queries themselves, and how many times they have been executed.

Number of Loaded Entities

In complement to these useful pieces of information, we recently added a new one: The Number of Loaded ORM Entities.

Many developers indeed rely on Object Relationship Mapping (ORM) libraries, like Doctrine ORM in PHP, to manipulate data coming from relational databases. However, when using an ORM, a common issue is that it may load too many objects than actually needed. This may happen when you want to count the number of items from a related entity collection (e.g. the number of comments related to an article). Depending on your configuration, the ORM might load the whole collection to perform the count programmatically, while a COUNT query would be sufficient.

Furthermore, creating and hydrating entities come with a cost. The more entities your application creates, the more resources it will eat, and the less performant it will become.

Blackfire now provides the number of Loaded ORM Entities, as a new key information to help you detect potential flaws related to it.

Oh, and it supports Doctrine ORM, Laravel Eloquent and Django ORM 😉.

Happy Profiling!

Jérôme Vieilledent

As a Developer Advocate, Jérôme is all about spreading the love! His technical/development background enable him to talk as a peer to peers with our developer users. You’ll read his tips and advices on performance management with Blackfire. And he’ll support you as a day-to-day user.