@@ -145,40 +145,17 @@ to manage multiple readers and ensure at-least-once delivery.
145145## Choose a data type
146146
147147The sections below explore the pros and cons of each data type for
148- particular tasks.
148+ particular tasks. Note that you should regard
149+ the suggestions as "rules-of-thumb" rather than strict prescriptions, since
150+ there are potentially many subtle reasons to prefer one data type over another.
149151
150152### Documents
151153
152154You would normally store document data using the string, hash, or JSON
153155types. JSON generally has the highest requirements for memory and processing,
154- followed by hashes, and then strings. Use the considerations below as a guide to
156+ followed by hashes, and then strings. Use the decision tree below as a guide to
155157choosing the best data type for your task.
156158
157- 1 . Do you need nested data structures (fields and arrays) or geospatial
158- index/query with Redis query engine?
159-
160- If so, use ** JSON** since it is the only type that supports these features.
161-
162- 2 . Do you need to index/query using Redis query engine but can live without
163- nested data structures and geospatial data?
164-
165- If so, use ** hashes** since they support indexing and querying with lower memory overhead and faster field access than JSON.
166-
167- 3 . Do you need to set expiration times on individual pieces of data within
168- the document?
169-
170- If so, use ** hashes** for efficient field-level access and expiration.
171-
172- 4 . Do you need frequent access to individual data fields within the document?
173-
174- If the data fields are simple integers or individual bits and you can
175- easily refer to them by an integer index, use ** strings** for efficient
176- access and minimum memory overhead. Otherwise, use ** hashes** for
177- named fields and support for string and binary field values.
178-
179- 5 . For other simple documents with arbitrary internal structure, use ** strings**
180- for simplicity and minimum memory overhead.
181-
182159``` decision-tree
183160rootQuestion: root
184161questions:
@@ -288,7 +265,7 @@ names matching the keys in the collection.
288265 need to store extra information for each key, consider using ** hashes** with
289266 the keys as field names.
290267
291- ## Sequences
268+ ### Sequences
292269
293270You would normally store sequences of string or binary data using sorted sets,
294271lists or streams. They each have advantages and disadvantages for particular purposes.
0 commit comments