Optimizing database interactions
Visual Studio 2022 introduces a new analyzer tool named Database Profiler. It allows us to explore the database interactions in our application.
In this section, we will explore how to use the Database Profiler tools and how they can help us identify query optimization opportunities in our code base.
To open it, we go through Performance Profiler and select Database, where we can combine it with CPU Usage for more insight.
Figure 4.18 – Selecting the Database and CPU Usage tools
When we click on the Start button, the profiler will launch our application and start collecting data. During this time, we can perform long-running actions on our application to identify the root cause of latency.
After clicking on the Stop Collection button, we launch the generation of the report.
Figure 4.19 – Database report
The database report will show us a table with information about queries...