Profiling Entity Framework Core 3.1 LINQ Queries running on Azure SQL Database using Azure Data Studio

Often you might be interested in knowing how your LINQ Queries are translated to SQL Database behind the scene.

By profiling, you can find

  1. Whether translated queries are optimum
  2. Performance issues/bottlenecks

The best way to profile ASP.NET Core, Entity Framework LINQ queries running on Azure SQL/ On-Premise SQL is to use Azure Data Studio.

What is Azure Data Studio?
Azure Data Studio is a free cross-platform database tool for data professionals using the Microsoft family of on-premises and cloud data platforms on Windows, MacOS, and Linux.

Azure Data Studio offers a modern editor experience with IntelliSense, code snippets, source control integration, and an integrated terminal. It’s engineered with the data platform user in mind, with the built-in charting of query result sets and customizable dashboards. It also supports multiple databases PostgreSQL is in preview at the time of writing.

In this blog, I will explain simple steps on how to set up profiling from scratch using Azure Data Studio in 5 minutes.

  1. Download and Install Azure Data Studio which runs on Windows, macOS, and Linux.

2. After installing the Azure Data studio. Install SQL Server Profiler Extension. Click on Extension Icon Search for a profiler, SQL Server Profiler will be listed. Install it.

Note: If a dialog appears to enable the preview feature then enable it.

3. The next step is to connect SQL Database. Click on the connection menu, New Connection.

4. Fill the Server details, and click connect

5. Right-click server name and select Launch Profile

6. Click on the Session menu a sidebar will appear for starting a new profiler session. Click start to start profiler.

7. Now run your application or Linq Queries, Azure Data studio will keep gathering live logs. You can find logs by clicking on any row as shown below.

8. You can also filter queries using the filter menu. Click on Filter then add a clause.

Select Field -> Text Data Operator -> Contains Value -> exec sp_executesql Click apply. Now queries will be filtered. Likewise, several filters are available based on your needs you can add filters.

That's it. Your setup is ready for profiling. Run your application and examine in translated LINQ queries live logs.

Profiling is a much-needed step in your application development life cycle it helps in finding bottlenecks, query performance and helps in improving application performance.

For more such interesting Tech Blog links visit my site https://sharetechlinks.com/

Tech Enthusiast, Full Stack Software Engineer, Product Manager, Engineering Enterprise SaaS product

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store