Upstash Documentation

ARINFO

Inspect the internal layout of an array.
3 min read

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#

ArgumentRequiredRepeatableDescription
<key>YesNoArray key targeted by the command.
FULLNoNoAlso 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.

ProtocolReply
RESP2Flat array of alternating field names and values
RESP3Map

Fields#

FieldDescription
lenHighest occupied index plus one, as reported by ARLEN.
countNumber of occupied slots, as reported by ARCOUNT.
slice-sizeNumber of indexes covered by one slice.
slicesNumber of slices currently allocated.
directory-sizeNumber of entries in the slice directory.
super-dir-entriesNumber of entries in the top-level directory.
next-insert-indexIndex the next ARINSERT would write to.
dense-slicesSlices stored in dense form. Only with FULL.
sparse-slicesSlices stored in sparse form. Only with FULL.
avg-dense-sizeAverage number of values in a dense slice. Only with FULL.
avg-dense-fillAverage fill ratio of a dense slice. Only with FULL.
avg-sparse-sizeAverage number of values in a sparse slice. Only with FULL.
Note

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
Note

This command is not supported yet in @upstash/redis.

upstash_redis
Note

This command is not supported yet in upstash_redis.

ioredis
node-redis
redis-py
go-redis
jedis
redis-rs