Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Time & clocks Remove topic Time & clocks 18 posts RSS

2026

ClickHouse

Querying DateTimes in ClickHouse

How-to 8 min +80 XP

ClickHouse's datetime functions cover rounding, filtering and duration calculations, demonstrated on about 3 million NYC taxi trips. toStartOfHour and toStartOfFifteenMinutes bucket timestamps, casting to ::Time groups or filters by time of day across all dates, and dateDiff computes trip durations to derive average speed, which falls from about 19 mph at 6am to about 11 mph by 8:30am. countIf with toDayOfWeek splits weekday and weekend trips, and the lag window function computes percentage change between windows. formatDateTime and bar make the output readable.

2025

2024

2022

2021

The quest for software engineering knowledge.

Look:
Layout: