Skip to content

[TEST PR/Don't approve] doc: warn against truncating mz_now()#35755

Open
sidsaw-mz wants to merge 1 commit intomainfrom
claude/slack-session-W0q3c
Open

[TEST PR/Don't approve] doc: warn against truncating mz_now()#35755
sidsaw-mz wants to merge 1 commit intomainfrom
claude/slack-session-W0q3c

Conversation

@sidsaw-mz
Copy link
Copy Markdown
Contributor

Summary

  • Adds a warning to the mz_now() idiomatic SQL docs about the anti-pattern of using date_trunc() or similar truncation on mz_now()
  • Truncating mz_now() causes batch processing instead of incremental pre-computation, defeating Materialize's core value

Motivation

From Slack discussion:

You shouldn't use MZ now with a truncated datetime, this should be considered a code-smell... mz_now on a truncated date should be considered an anti-pattern, since it literally causes a batch of data... it means we're not pre-computing

Test plan

  • Preview the docs site to verify the warning renders correctly

https://claude.ai/code/session_019eLFNUkcgdEP7gaEKmLUtd

Add a warning about the anti-pattern of using date_trunc() or similar
truncation on mz_now(). This causes batch processing rather than
incremental pre-computation, defeating Materialize's core value.

https://claude.ai/code/session_019eLFNUkcgdEP7gaEKmLUtd
@sidsaw-mz sidsaw-mz requested a review from a team as a code owner March 27, 2026 17:37
@github-actions
Copy link
Copy Markdown

Thanks for opening this PR! Here are a few tips to help make the review process smooth for everyone.

PR title guidelines

  • Use imperative mood: "Fix X" not "Fixed X" or "Fixes X"
  • Be specific: "Fix panic in catalog sync when controller restarts" not "Fix bug" or "Update catalog code"
  • Prefix with area if helpful: compute: , storage: , adapter: , sql:

Pre-merge checklist

  • The PR title is descriptive and will make sense in the git log.
  • This PR has adequate test coverage / QA involvement has been duly considered. (trigger-ci for additional test/nightly runs)
  • If this PR includes major user-facing behavior changes, I have pinged the relevant PM to schedule a changelog post.
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).

@sidsaw-mz sidsaw-mz changed the title doc: warn against truncating mz_now() [TEST PR/Don't approve] doc: warn against truncating mz_now() Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants