Question 440
A report wraps an indexed datetime column in CONVERT(date, col) and performs a table scan on a busy ledger. The team implemented this change: Rewrite to start-inclusive/end-exclusive datetime bounds and test index use. Which result would best confirm the change worked?
Explanation
Correct Answer
Plan reads fewer rows without missing events at midnight. Range predicates on the raw indexed column are often more sargable than wrapping it in functions. Time zone conversion and daylight-saving transitions require explicit policy.
Incorrect Answers
That observation could pass while the problem persists: A raw-column range is often more seekable; verify the actual plan, types and boundaries.
This acceptance test measures the wrong outcome: Use a start-inclusive/end-exclusive range with the correct precision and time-zone interpretation.
The suggested success signal is inadequate because Match SQL parameter types to stored datetime type and test plan and boundary behavior. The suggested measurement would appear successful even in a reproducible case where the original failure remains.