Sample Header Ad - 728x90

Understanding last_request_start_time and last_request_end_time in sys.dm_exec_sessions

1 vote
1 answer
286 views
I've been working with the sys.dm_exec_sessions dynamic management view and I'm hoping to gain a better understanding of the last_request_start_time and last_request_end_time columns. From the documentation: > **last_request_start_time** datetime Time at which the last request on the session began. This includes the currently executing request. Not nullable. > **last_request_end_time** datetime Time of the last completion of a request on the session. Is nullable. From this, I'm interpreting that if there's currently an executing request (active request), the last_request_start_time will always be the start time of the currently executing request, and not the "last" request start time. If my understanding is correct, I'm having a hard time seeing the utility of these two columns. They don't always describe the same request, which seems counterintuitive. I've captured the following data on my server. In the second to last row, the last_request_start_time is 2023-10-22 14:11:20.667 and last_request_end_time is 2023-10-22 14:11:20.663.
+-------------------------+-------------------------+
| last_request_start_time | last_request_end_time   |
+-------------------------+-------------------------+
| 2023-10-21 15:20:54.410 | 2023-10-21 15:20:54.410 |
| 2023-10-21 15:20:54.410 | 2023-10-21 15:20:54.410 |
| 2023-10-21 15:20:54.410 | 2023-10-21 15:20:54.410 |
| 2023-10-22 14:11:20.667 | 2023-10-22 14:11:20.663 |
| 2023-10-21 15:20:22.690 | NULL                    |
+-------------------------+-------------------------+
Based on the above, does this imply that the current active request starts at 2023-10-22 14:11:20.667 and the last request ended at 2023-10-22 14:11:20.663? I appreciate your insights on this.
Asked by Fajela Tajkiya (1239 rep)
Oct 22, 2023, 06:36 AM
Last activity: Nov 29, 2023, 06:03 PM