# -Merge & -State aggregators

While the SQL syntax for querying JSON events is intuitive, the SQL syntax required to query time series stored on local fast NVMe drives can be a little tricky.

**In order to be extremely fast, time series are heavily compressed and leverage ClickHouse's -Merge and -State combinators.**

In practice, this means that you need to be mindful about how to query a particular data type based on its definition.

## Example: Getting the number of events

When querying **JSON events**, this is as simple as

```sql
[label Querying the number of JSON events]
SELECT COUNT(*)
FROM {{source}}
```

If you want to get the **same result from time series**, you need to query

```sql
[label Querying the number of JSON events using time series]
SELECT countMerge(events_count)
FROM {{source}}
```

As the physical number of rows stored locally on your NVMe drives will be different to the number of events ingested. 

Read more about -State and -Merge aggregators [on the official ClickHouse blog](https://clickhouse.com/blog/aggregate-functions-combinators-in-clickhouse-for-arrays-maps-and-states).

## Where can I see available combinators?

1. Go to **Warehouse** -> [Sources](https://warehouse.betterstack.com/team/0/sources ";_blank").
2. Select your source and click **Configure**.
3. Switch to the **Time series on NVMe SSD** tab.
4. Expand the time series details to see the functions to **Query with**:

![Xnapper-2025-10-20-19.09.36.png](https://imagedelivery.net/xZXo0QFi-1_4Zimer-T0XQ/1e266490-25c8-4085-5cca-3b8486b9a800/public =3382x2172)

## Need help?

We're here for you! Let us know at [hello@betterstack.com](mailto:hello@betterstack.com). 
