| 资产 | 价值 |
|---|---|
| RuleID | QA1007 |
| Title | GetCurrentDateTime (获取当前日期时间) |
| 类别 | Performance |
原因
查询 GetCurrentDateTime 在 WHERE 子句中使用。
规则说明
该函数 GetCurrentDateTime 不使用索引,可能会导致更高的 RU 费用和查询性能变慢。
建议
请考虑改用 GetCurrentDateTimeStatic ,它利用索引并具有确定性。 有关详细信息 GetCurrentDateTimeStatic,请参阅 GetCurrentDateTimeStatic。
Example
原始查询:
SELECT *
FROM c
WHERE c.timestamp > GetCurrentDateTime()
修订后的查询:
SELECT *
FROM c
WHERE c.timestamp > GetCurrentDateTimeStatic()