QA1009: GetCurrentTimestamp

This advisor message is returned when a query uses the GetCurrentTimestamp function in a WHERE clause. The message clarifies the reason and provides guidance to improve query performance.

Properties

Value
RuleID QA1009
Title GetCurrentTimestamp
Category Performance

Cause

The query uses GetCurrentTimestamp in the WHERE clause.

Rule Description

The function GetCurrentTimestamp doesn't utilize index and can cause higher RU charge and slower query performance.

Recommendation

Consider using GetCurrentTimestampStatic instead, which utilizes index and is deterministic. For more information on GetCurrentTimestampStatic, see GetCurrentTimestampStatic.

Example

Original query:

SELECT * 
FROM c 
WHERE c.timestamp > GetCurrentTimestamp()

Revised query:

SELECT * 
FROM c 
WHERE c.timestamp > GetCurrentTimestampStatic()