# XINFO STREAM

> Show a stream's length, ID bookkeeping, and first and last entries.

URL: https://docs.hotkv.com/commands/xinfo-stream/

```
XINFO STREAM key [FULL [COUNT count]]
```

- Group: Stream
- Complexity: O(1), or O(N) with FULL for the entries and pending entries returned
- HotKV Cloud: all plans
- On-Premise: no license needed

`XINFO STREAM` reports on the stream at `key`.

## Fields

| Field | Meaning |
| --- | --- |
| `length` | Number of entries. |
| `radix-tree-keys`, `radix-tree-nodes` | Compatibility fields for clients that read them. The values can differ from Redis. |
| `last-generated-id` | The highest ID ever given to an entry. |
| `max-deleted-entry-id` | The highest ID ever deleted (`0-0` if none). |
| `entries-added` | Entries ever added, including deleted ones. |
| `recorded-first-entry-id` | The ID of the first entry (`0-0` when empty). |
| `idmp-duration`, `idmp-maxsize` | How long, in seconds, and how many idempotent IDs the stream keeps for each producer (set with [XCFGSET](https://docs.hotkv.com/commands/xcfgset/index.md)). |
| `pids-tracked`, `iids-tracked` | Producers and idempotent IDs the stream holds now. |
| `iids-added`, `iids-duplicates` | Entries added with an idempotent ID, and adds that [XADD](https://docs.hotkv.com/commands/xadd/index.md) turned away because the ID was already known. |
| `groups` | Number of consumer groups. |
| `first-entry`, `last-entry` | The first and last entries as `[id, [field, value, ...]]`, or nil when the stream is empty. |

## Options

| Option | Effect |
| --- | --- |
| `FULL` | Replace `groups`, `first-entry` and `last-entry` with `entries` (the entries in ID order) and `groups` (each group with its pending entries and consumers). |
| `COUNT count` | With `FULL`, the most entries, and pending entries per group and per consumer, to show. Default 10; 0 or less shows all. |

With `FULL`, each group has `name`, `last-delivered-id`, `entries-read`,
`lag`, `pel-count`, `pending` (each `[id, consumer, delivery-time, delivery-count]`)
and `consumers`. Each consumer has `name`, `seen-time`, `active-time`,
`pel-count` and `pending` (each `[id, delivery-time, delivery-count]`). Times
are Unix times in milliseconds. `active-time` is `-1` for a consumer that has
not yet received entries from `XREADGROUP` or claimed any.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Stream exists | Flat array of field names and values | Map |

Error replies:

- `ERR no such key` when the stream does not exist.
- `ERR unknown subcommand or wrong number of arguments for 'STREAM'. Try XINFO HELP.` for anything other than `FULL [COUNT count]`.
- `ERR value is not an integer or out of range` for a bad count, and `WRONGTYPE`.

## Examples

```
127.0.0.1:6379> XADD tasks 1700000000000-0 job email
"1700000000000-0"
127.0.0.1:6379> XADD tasks 1700000000001-0 job sms
"1700000000001-0"
127.0.0.1:6379> XGROUP CREATE tasks workers 0
OK
127.0.0.1:6379> XINFO STREAM tasks
 1) "length"
 2) (integer) 2
 3) "radix-tree-keys"
 4) (integer) 1
 5) "radix-tree-nodes"
 6) (integer) 1
 7) "last-generated-id"
 8) "1700000000001-0"
 9) "max-deleted-entry-id"
10) "0-0"
11) "entries-added"
12) (integer) 2
13) "recorded-first-entry-id"
14) "1700000000000-0"
15) "idmp-duration"
16) (integer) 100
17) "idmp-maxsize"
18) (integer) 100
19) "pids-tracked"
20) (integer) 0
21) "iids-tracked"
22) (integer) 0
23) "iids-added"
24) (integer) 0
25) "iids-duplicates"
26) (integer) 0
27) "groups"
28) (integer) 1
29) "first-entry"
30) 1) "1700000000000-0"
    2) 1) "job"
       2) "email"
31) "last-entry"
32) 1) "1700000000001-0"
    2) 1) "job"
       2) "sms"
```

## Compatibility

Same fields as Redis 7.2 and Valkey 8, plus the idempotent-producer fields of
Redis 8.6. In the `FULL` form, `seen-time` is when the consumer was last seen (made,
read or claimed) and `active-time` is when it last received or claimed
entries, `-1` if never.

## See also

[XINFO](https://docs.hotkv.com/commands/xinfo/index.md), [XINFO GROUPS](https://docs.hotkv.com/commands/xinfo-groups/index.md), [XINFO CONSUMERS](https://docs.hotkv.com/commands/xinfo-consumers/index.md),
[XLEN](https://docs.hotkv.com/commands/xlen/index.md), [XSETID](https://docs.hotkv.com/commands/xsetid/index.md)