@@ -32,8 +32,9 @@ The remaining data types are more general-purpose:
3232
3333- [ Strings] ({{< relref "/develop/data-types/strings" >}}):
3434 store text or binary data.
35- - [ Arrays] ({{< relref "/develop/data-types/arrays" >}}):
36- store text or binary data in a list.
35+ - [ Arrays] ({{< relref "/develop/data-types/arrays" >}}):
36+ store strings addressed by integer index, with support for sparse
37+ indices and server-side aggregation.
3738- [ Hashes] ({{< relref "/develop/data-types/hashes" >}}):
3839 store key-value pairs within a single key.
3940- [ JSON] ({{< relref "/develop/data-types/json" >}}):
@@ -322,7 +323,7 @@ questions:
322323### Sequences
323324
324325You would normally store sequences of string or binary data using sorted sets,
325- lists, or streams . They each have advantages and disadvantages for particular purposes.
326+ lists, streams, or arrays . They each have advantages and disadvantages for particular purposes.
326327Use the decision tree below as a guide to choosing the best data type for your task.
327328
328329``` decision-tree {id="sequences-tree"}
@@ -333,17 +334,35 @@ questions:
333334 root:
334335 text: |
335336 Do you need to maintain an arbitrary priority order, lexicographical order,
336- frequently access elements by index, or perform set operations?
337+ or perform set operations?
337338 whyAsk: |
338- Sorted sets are the only sequence type that supports both ordering and set operations.
339- While lists also support indexing, it is O(n) for lists but O(log n) for sorted sets,
340- so sorted sets are more efficient if you need frequent index access
339+ Sorted sets are the only sequence type that supports both ordering and set operations
341340 answers:
342341 yes:
343342 value: "Yes"
344343 outcome:
345344 label: "Use sorted sets"
346345 id: sortedSetsOutcome
346+ no:
347+ value: "No"
348+ nextQuestion: indexedAccess
349+ indexedAccess:
350+ text: |
351+ Do you need to address elements by a caller-chosen integer index
352+ (including sparse or non-contiguous indices), perform server-side
353+ aggregation over index ranges (sum, min, max, bitwise), or use a
354+ fixed-size ring buffer that overwrites the oldest entries?
355+ whyAsk: |
356+ Arrays map integer indices directly to string values with O(1) access,
357+ support sparse indexing without allocating the gaps, and include
358+ server-side aggregation and ring-buffer operations that lists and
359+ streams do not provide
360+ answers:
361+ yes:
362+ value: "Yes"
363+ outcome:
364+ label: "Use arrays"
365+ id: arraysOutcome
347366 no:
348367 value: "No"
349368 nextQuestion: timestampOrder
0 commit comments