sfmc // SQLPRODUCTION

SARGable Rolling Date Window

Filter recent Data View rows without wrapping the source date column in a function.

sqlperformancedateaddsargable
Context Pack →Open Workspace →
Trust & provenancePRODUCTION
Evidence tierPRODUCTIONOfficial sources1Other sources0Last verified2026-10-05

Evidence tier describes my hands-on relationship with the content. Official sources describe platform contracts/documentation. Production observations should not automatically be treated as official limits.

EvidencePRODUCTION
Difficultyfoundation
Verified2026-10-05
Use when

Filtering large Data Views or Data Extensions by a recent time window.

SELECT
    SubscriberKey,
    JobID,
    EventDate
FROM _Sent
WHERE EventDate >= DATEADD(day, -30, GETDATE())
Why it works

The source column remains directly searchable while the boundary is calculated once on the other side of the predicate.

Operational notes

Salesforce calls non-SARGable predicates a common timeout pattern in Query Activities.

Gotchas

Avoid patterns such as DATEDIFF(day, EventDate, GETDATE()) <= 30 on large sources.

Related
Sources / verification