QA1007: GetCurrentDateTime

Property Value
RuleID QA1007
Title GetCurrentDateTime
Category Performance

Cause

The query uses GetCurrentDateTime in the WHERE clause.

Rule Description

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

Recommendation

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

Example

Original query:

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

Revised query:

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