Wednesday, November 9, 2022

what is SQL Profiler


What is SQL Server Profiler:


The SQL Server Profiler is a performance tool which included with any version of SQL Server. It generally shows how SQL Server accesses the database internally. This tool is used by developers as well as a performance engineering team to analyze which SQL statements take more time to execute. It shows information like, how many reads and writes happened in a transaction, the duration it takes to complete the transaction and information such as that is displayed to show complete information of events occurring in the database end.


Why SQL Server Profiler:

Consider a scenario like, you have made a request to an aspx page, it took 20 seconds to load the page. So it's a performance issue here. Here we need to find out what takes the most amount of time, either in the front end or in the back end. In a single request of an aspx page, there may be n number of database hits based on the functionality; here we need to find out what are all the SQL statements executed in this page request. There the SQL Server Profiler helps you to trace the information on the page request.


How to Use SQL Server Profiler:

Enter the profiler keyword in run command; it will launch the profiler window to connect to the appropriate database. Once the database is connected, the trace will be started; now click the page where you want to trace the information. Stop the trace once the page request is completed; now you can see all the transactions that are performed in that single page request.

the trace information will be displayed in the screen like below.

EventClass - Event Name occurred

TextData - Stored Procedure name or the SQL Statement that is executed

Application Name - Which application invoked this SQL statement

Like that various information will be tracked using the profiler.


Different Scenarios for Using SQL Server Profiler

  1. To find the worst performing queries or stored procedures
  2. To monitor Transact- SQL activity per user
  3. To view the connections involved in a Deadlock


Step By Step to Use Profiler

1.Launch Profiler Tool from Run Command

2.Connect to the appropriate Database

3.Configure the Properties

4.Select the Events that you need

5.

 https://www.c-sharpcorner.com/UploadFile/babu_2082/using-sql-server-profiler/


No comments:

Post a Comment

How to use SQL pagination using LIMIT and OFFSET

  How to extract just a portion of a larger result set from a SQL SELECT. LIMIT n is an alternative syntax to the FETCH FIRST n ROWS ONLY. T...