Question 540
A report wraps an indexed datetime column in CONVERT(date, col) and performs a table scan on a busy ledger. The team proposes this approach: Rewrite to start-inclusive/end-exclusive datetime bounds and test index use. Which technical principle supports this approach?
Explanation
Correct Answer
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 explanation assumes the wrong technical cause: A raw-column range is often more seekable; verify the actual plan, types and boundaries.
The proposed mechanism is not sufficient because Use a start-inclusive/end-exclusive range with the correct precision and time-zone interpretation.
This inference does not follow from the SQL or service behavior: Match SQL parameter types to stored datetime type and test plan and boundary behavior. The stated assumption would still allow the documented defect to occur, so it cannot explain why the proposed fix works.