peter.petrov
peter.petrov

Reputation: 39477

SQL Server - dm_exec_sessions - last_request_end_time smaller than last_request_start_time

When using the query below, I can see that for some of the records
returned last_request_end_time is smaller than last_request_start_time.

What is the reason for that? Is that condition an indication
of which records represent waiting/blocked sessions?

SELECT 
session_id AS "spid",
login_time,
"host_name",
"program_name",
login_name,
nt_user_name,
last_request_start_time,
last_request_end_time
FROM
    sys.dm_exec_sessions
WHERE
    session_id IN (52, 53);

Upvotes: 1

Views: 1295

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1270371

This is a big long for a comment but the "maybe" appears to be true. These fields are documented as:

last_request_start_time datetime

Time at which the last request on the session began. This includes the currently executing request. Is not nullable.

last_request_end_time datetime

Time of the last completion of a request on the session. Is nullable.

I just checked on a very quiescent system, and see a row with the same values. When a request starts, it affects the start time but it doesn't NULL the end time.

Upvotes: 2

Related Questions