Use ARINFO to inspect how an array is laid out in memory.
Alongside len and count, which ARLEN and ARCOUNT also report, the reply describes the slice structure the array is stored in and where the append cursor sits. That is useful when a sparse array is not behaving the way its access pattern suggests it should: a low fill ratio across many slices means the indexes in use are spread thinly, which costs more memory per stored value than a denser layout would.
FULL adds statistics about the dense and sparse slices, which requires walking the whole array rather than reading summary counters.
See the array command overview for the data model these commands share.
Syntax#
Arguments#
| Argument | Required | Repeatable | Description |
|---|---|---|---|
<key> | Yes | No | Array key targeted by the command. |
FULL | No | No | Also report per-slice statistics. This walks the whole array. |
Important points#
- A key that does not exist returns
ERR no such key.
Response#
The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.
| Protocol | Reply |
|---|---|
| RESP2 | Flat array of alternating field names and values |
| RESP3 | Map |
Fields#
| Field | Description |
|---|---|
len | Highest occupied index plus one, as reported by ARLEN. |
count | Number of occupied slots, as reported by ARCOUNT. |
slice-size | Number of indexes covered by one slice. |
slices | Number of slices currently allocated. |
directory-size | Number of entries in the slice directory. |
super-dir-entries | Number of entries in the top-level directory. |
next-insert-index | Index the next ARINSERT would write to. |
dense-slices | Slices stored in dense form. Only with FULL. |
sparse-slices | Slices stored in sparse form. Only with FULL. |
avg-dense-size | Average number of values in a dense slice. Only with FULL. |
avg-dense-fill | Average fill ratio of a dense slice. Only with FULL. |
avg-sparse-size | Average number of values in a sparse slice. Only with FULL. |
Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.
Examples#
TCP examples use the TLS REDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.
Redis CLI
@upstash/redis
This command is not supported yet in @upstash/redis.
upstash_redis
This command is not supported yet in upstash_redis.