---
title: ALIGN
url: https://nexyron.tech/docs/cypher/clauses/time/align
description: Normalize timestamps onto a regular grid or step.
---

# ALIGN

## Generic Description

Normalize timestamps onto a regular grid or step.

Simple example:

```cypher
MATCH (r:Reading) ALIGN BY 60 ON r.ts RETURN r
```

## Consumer-Level Explanation

Use `ALIGN` when the query must normalize timestamps onto a regular grid or step and the planner needs to see that operation as part of the Cypher row pipeline. Keep the clause explicit because it controls row grain, variable scope, and what later clauses are allowed to reference.

## More Detailed Explanation

ALIGN is useful when comparing time-series-like values that arrive at irregular instants. It prepares data for bucketing, comparison, or downstream joins by making the time dimension more regular.

What this clause is really for:

-   it defines one concrete stage in the Cypher row pipeline, so variables available before and after `ALIGN` must be clear
-   it should make graph structure, temporal filters, document payload shaping, or procedure output explicit instead of relying on client-side interpretation
-   planner tooling depends on this clause boundary to know row grain, variable scope, and whether later expressions are reads, writes, schema operations, or projections

## Advanced Example

This example keeps `ALIGN` inside a complete query pipeline so the clause boundary, visible variables, and returned row shape are clear to planner tooling.

```cypher
MATCH (s:Sensor)-[r:EMITS]->(m:Measurement)
TIME r.ts BETWEEN datetime('2025-01-01T00:00:00Z') AND datetime('2025-01-07T00:00:00Z')
WITH s, r, m, date_trunc('hour', r.ts) AS bucket, properties(m) AS payload
RETURN s.sensor_id, bucket, keys(payload) AS payload_keys, unpivot(payload) AS metrics
ORDER BY bucket DESC
```

## Real Use Cases

-   normalizing sparse metrics before aggregation
-   preparing temporal-property history for comparison across entities
-   cleaning uneven telemetry for later analytics

## Real Limitations And Tradeoffs

-   alignment changes representation and can hide original irregularity if overused
-   needs a meaningful step size
-   should usually be documented in user-facing analytics outputs
