doc/user/content/transform-data/idiomatic-materialize-sql/mz_now.md
In Materialize, mz_now() function returns
Materialize's current virtual timestamp (i.e., returns
mz_timestamp). The function can be used in
temporal filters to reduce the
working dataset.
mz_now() expression has the following form:
mz_now() <comparison_operator> <numeric_expr | timestamp_expr>
mz_now() expressions to calculate past or future timestampIdiomatic Materialize SQL: {{< include-md file="shared-content/mz_now_operators.md" >}}
{{< yaml-table data="mz_now/mz_now_operators" noHeader="true" >}}
OR){{< include-md file="shared-content/mz_now_clause_disjunction_restrictions.md"
}}
For example:
{{< yaml-table data="mz_now/mz_now_combination" >}}
Idiomatic Materialize SQL: When mz_now() is included in a materialized
view definition, a view definition that is being indexed, or a SUBSCRIBE
statement, instead of using disjunctions (OR) when using mz_now(), rewrite
the query to use UNION ALL or UNION instead, deduplicating as necessary:
In some cases, you may need to modify the conditions to deduplicate results
when using UNION ALL. For example, you might add the negation of one input's
condition to the other as a conjunction.
In some cases, using UNION instead of UNION ALL may suffice if the inputs
do not contain other duplicates that need to be retained.
{{< yaml-table data="mz_now/mz_now_disjunction_alternatives" noHeader="true" >}}