1

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.

0

1 Answer 1

1

Those columns are not necessarily tied to the same request in a session.

The very first request of a session will have start & end times for the same request, but not subsequently.

On the 4th line it appears that the end time is prior to the start time, but it is not the same request that the start time is for.

It makes more sense if the columns are reversed in sequence.

On the 4th line, the session already completed a request at 2023-10-22 14:11:20.663 and has started a new (later) request at 2023-10-22 14:11:20.667

The last line shows a session which has connected & started a request, but that it has yet to complete one.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.