Unlock this content

Enter your email to unlock this content for free

By continuing, you agree to our Terms of Service and Privacy Notice, and to receive occasional marketing emails.

Date and Time

TL;DR

Choose the lowest DateTime precision needed (DateTime for seconds, DateTime64(3) for milliseconds) to avoid massive storage overhead. Do not default to nanoseconds (DateTime64(9)). Store timestamps in UTC and convert at query time. Use Date for rollups, DateTime for events.

Choosing Date Types

Use Date for: Day-level granularity, daily rollups, aggregations, when storage efficiency is critical.

Use DateTime for: Events with timestamps, time-of-day information, second-level precision (most common for event data).

Use DateTime64(3) for: Events requiring millisecond precision (web analytics, API monitoring).

Use DateTime64(9) for: Only if you truly need nanosecond precision (rare specialized use cases).

Precision Comparison

Tinybird is not affiliated with, associated with, or sponsored by ClickHouse, Inc. ClickHouse® is a registered trademark of ClickHouse, Inc.

Date and Time | ClickHouse for Developers