Profiling Entity Framework Core 3.1 LINQ Queries running on Azure SQL Database using Azure Data Studio Bharat Dwarkani Follow Feb 14 · 3 min read

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

By profiling, you can find

Whether translated queries are optimum 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.

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.

Installing SQL Server profiler extension

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

Connecting to the database

4. Fill the Server details, and click connect

Updating connection details

5. Right-click server name and select Launch Profile

Launching Profiler

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

Launching profiler session

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.

Getting Live Query Logs

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

Filtering Server Logs

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.

Filtering

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/