@@ -260,11 +260,65 @@ names matching the keys in the collection.
260260 If so, use the bitmap features of ** strings** for minimum memory overhead and efficient random access. String bitmaps also support bitwise operations
261261 that are equivalent to set operations such as union, intersection, and difference.
262262
263- 3 . For arbitrary string or binary keys, use ** sets** for efficient membership tests and
263+ 3 . For arbitrary string or binary keys, use ** sets** for efficient membership tests and
264264 set operations. If you * only* need membership tests on the keys, but you
265265 need to store extra information for each key, consider using ** hashes** with
266266 the keys as field names.
267267
268+ ``` decision-tree
269+ rootQuestion: root
270+ questions:
271+ root:
272+ text: |
273+ Do you need to store and retrieve the keys in an arbitrary order or in
274+ lexicographical order?
275+ whyAsk: |
276+ Sorted sets are the only collection type that supports ordered iteration,
277+ which is essential if you need to access elements in a specific order
278+ answers:
279+ yes:
280+ value: "Yes"
281+ outcome:
282+ label: "Use sorted sets"
283+ id: sortedSetsOutcome
284+ no:
285+ value: "No"
286+ nextQuestion: extraInfo
287+ extraInfo:
288+ text: |
289+ Do you need to store extra information for each key in the collection,
290+ and do you NOT need set operations (union, intersection, difference)?
291+ whyAsk: |
292+ Hashes allow you to associate data with each key, but they don't support
293+ set operations. If you need both extra data and set operations, sets are not suitable
294+ answers:
295+ yes:
296+ value: "Yes"
297+ outcome:
298+ label: "Use hashes"
299+ id: hashesOutcome
300+ no:
301+ value: "No"
302+ nextQuestion: integerIndices
303+ integerIndices:
304+ text: |
305+ Are the keys always simple integer indices in a known range?
306+ whyAsk: |
307+ String bitmaps provide minimum memory overhead and efficient random access
308+ for integer indices, with bitwise operations equivalent to set operations
309+ answers:
310+ yes:
311+ value: "Yes"
312+ outcome:
313+ label: "Use strings (bitmaps)"
314+ id: stringsOutcome
315+ no:
316+ value: "No"
317+ outcome:
318+ label: "Use sets"
319+ id: setsOutcome
320+ ```
321+
268322### Sequences
269323
270324You would normally store sequences of string or binary data using sorted sets,
0 commit comments