# points_int

Integer time series: counters, discrete states, bitfields, and anything else recorded as a whole number.

Telemetry table, so every query must filter by `dataset_rid`.

For what a channel is, see [Channels](https://dev.nominal.io/platform/data-model.md#channels) in the data model.

## Columns

| Column | Type | Nullable | Notes |
| --- | --- | --- | --- |
| `ts` | `TIMESTAMP` | No | Sample time, nanosecond precision. |
| `value` | `BIGINT` | Yes | The sample. Null where a sample exists but carries no value. |
| `channel` | `VARCHAR` | No | Channel name. |
| `dataset_rid` | `VARCHAR` | No | Dataset the sample belongs to. Required in the `WHERE` clause. |
| `tags` | `MAP` | No | Key-value pairs recorded with the series. See [Filtering by tag](https://dev.nominal.io/sql-guides/writing-queries.md#filtering-by-tag). |

## Examples

Read a counter over time:

```sql
SELECT ts, value
FROM points_int
WHERE dataset_rid = '<dataset-rid>'
  AND channel = 'packet_count'
ORDER BY ts
LIMIT 1000
```

How long each discrete state was reported:

```sql
SELECT value AS state, COUNT(*) AS samples
FROM points_int
WHERE dataset_rid = '<dataset-rid>'
  AND channel = 'system_mode'
GROUP BY value
ORDER BY samples DESC
```

Test a single bit of a status word. The bitwise functions are telemetry-only and take a literal bit index from 0 to 63:

```sql
SELECT ts, BIT_TEST(value, 3) AS fault_bit_set
FROM points_int
WHERE dataset_rid = '<dataset-rid>'
  AND channel = 'status_word'
ORDER BY ts
```

## Next steps

- [Function reference](https://dev.nominal.io/sql-reference/schema/function-reference.md): the bitwise functions and their operand rules.
- [points_double](https://dev.nominal.io/sql-reference/schema/points_double.md): floating-point series.
