Extract the minute-of-hour (0 through 59) from a timestamp.
MINUTE(timestamp)
## Overview Extracts the minute-of-hour component from a TIMESTAMP (or TIME) value, returned as an INTEGER between 0 and 59. Equivalent to EXTRACT(MINUTE FROM input). Use MINUTE for fine-grained time-of-day distributions, rate-limiting windows, and for building 5-minute or 15-minute buckets via arithmetic on the returned value. ## Behavior - Returns an INTEGER in the range 0 through 59. - Returns NULL if the argument is NULL. - Accepts TIMESTAMP, TIMESTAMP WITH TIME ZONE, and TIME inputs. ## Timezone handling - TIMESTAMP WITH TIME ZONE values are converted to the session zone before the minute is taken. - Minute values are unaffected by DST (offsets always change on whole-hour or half-hour boundaries in practice). ## Compatibility - Equivalent to EXTRACT(MINUTE FROM source).
| Name | Type | Description |
|---|---|---|
timestamp | Specifies the timestamp or time value from which to extract the minute component. |
-- Minute within the hour
SELECT MINUTE(TIMESTAMP '2025-03-15 14:37:22') AS mi;
-- Top of the hour returns 0
SELECT MINUTE(TIMESTAMP '2025-03-15 09:00:00') AS mi;
-- Events by minute within the hour
SELECT MINUTE(event_ts) AS mi, COUNT(*) AS cnt
FROM telemetry.web.requests
GROUP BY mi
ORDER BY mi;
-- Five-minute buckets within the hour
SELECT (MINUTE(event_ts) / 5) * 5 AS five_min_bucket, COUNT(*) AS events
FROM telemetry.web.requests
GROUP BY five_min_bucket
ORDER BY five_min_bucket;
-- Filter rows at specific minute marks (on the quarter)
SELECT event_id FROM telemetry.web.requests
WHERE MINUTE(event_ts) IN (0, 15, 30, 45);