You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/commands/info/index.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -515,3 +515,24 @@ It won't be included when `INFO` or `INFO ALL` are called, and it is returned on
515
515
**A note about the word slave used in this man page**: Starting with Redis 5, if not for backward compatibility, the Redis project no longer uses the word slave. Unfortunately in this command the word slave is part of the protocol, so we'll be able to remove such occurrences only when this API will be naturally deprecated.
516
516
517
517
**Modules generated sections**: Starting with Redis 6, modules can inject their information into the `INFO` command. These are excluded by default even when the `all` argument is provided (it will include a list of loaded modules but not their generated info fields). To get these you must use either the `modules` argument or `everything`.
| <spantitle="Supported">✅ Standard</span><br /><spantitle="Supported"><nobr>✅ Active-Active</nobr></span> | <spantitle="Supported">✅ Standard</span><br /><spantitle="Supported"><nobr>✅ Active-Active</nobr></span> | In Redis Enterprise, `INFO` returns a different set of fields than Redis Community Edition.<br />Not supported for [scripts]({{<relref "/develop/interact/programmability">}}). |
524
+
525
+
Note: key memory usage is different on Redis Software or Redis Cloud active-active databases than on non-active-active databases. This is because memory usage includes some amount of CRDB overhead.
526
+
527
+
Additionally, for JSON keys, Redis implements a “shared string” mechanism to save memory when the same JSON field names or field values of type string are used more than once (either inter-key or intra-key).
528
+
In such cases, instead of storing the field names or values many times, Redis stores them only once. This mechanism is not in place for active-active databases.
529
+
530
+
On non-active-active databases, `INFO` (Memory > used_memory) reports that the shared memory is counted, but only once for all keys. On active-active databases, there is no shared memory, so if strings are repeated, they are stored multiple times.
531
+
532
+
**Example**
533
+
534
+
Suppose you have ten JSON keys, and each key has 5KB of unique content and 5KB of shared content.
535
+
536
+
For non-active-active databases, `INFO` (used_memory) would report (10 keys * 5KB) + 5KB ~= 55KB. The last term, "+ 5KB", is the size of the shared content.
537
+
538
+
For active-active databases, `INFO` (used_memory) would report 10 keys * 20KB ~= 200KB. This number includes some amount of CRDB overhead per JSON key.
|<spantitle="Supported">✅ Standard</span><br /><spantitle="Supported"><nobr>✅ Active-Active</nobr></span> | <spantitle="Supported">✅ Standard</span><br /><spantitle="Supported"><nobr>✅ Active-Active</nobr></span> | Not supported for [scripts]({{<relref "/develop/interact/programmability">}}) in Redis versions earlier than 7. |
96
+
97
+
Note: key memory usage is different on Redis Software or Redis Cloud active-active databases than on non-active-active databases. This is because memory usage includes some amount of CRDB overhead.
For example, let's add again our list of famous hackers, but this time
166
+
For example, let's add again our list of famous racers, but this time
167
167
using a score of zero for all the elements. We'll see that because of the sorted sets ordering rules, they are already sorted lexicographically. Using [`ZRANGEBYLEX`]({{< relref "/commands/zrangebylex" >}}) we can ask for lexicographical ranges:
@@ -92,9 +92,9 @@ Here is an explanation of the additional constructs:
92
92
93
93
The following query shows you how to group by the field `condition` and apply a reduction based on the previously derived `price_category`. The expression `@price<1000` causes a bicycle to have the price category `1` if its price is lower than 1000 USD. Otherwise, it has the price category `0`. The output is the number of affordable bicycles grouped by price category.
94
94
95
-
```
95
+
{{< clients-example query_agg agg2 >}}
96
96
FT.AGGREGATE idx:bicycle "*" LOAD 1 price APPLY "@price<1000" AS price_category GROUPBY 1 @condition REDUCE SUM 1 "@price_category" AS "num_affordable"
97
-
```
97
+
{{< /clients-example >}}
98
98
99
99
```
100
100
1) "3"
@@ -123,9 +123,9 @@ You can't use an aggregation function outside of a `GROUPBY` clause, but you can
123
123
124
124
Here is an example that adds a type attribute `bicycle` to each document before counting all documents with that type:
125
125
126
-
```
126
+
{{< clients-example query_agg agg3 >}}
127
127
FT.AGGREGATE idx:bicycle "*" APPLY "'bicycle'" AS type GROUPBY 1 @type REDUCE COUNT 0 AS num_total
128
-
```
128
+
{{< /clients-example >}}
129
129
130
130
The result is:
131
131
@@ -143,28 +143,28 @@ It's sometimes necessary to group your data without applying a mathematical aggr
143
143
144
144
The following example shows how to group all bicycles by `condition`:
Copy file name to clipboardExpand all lines: content/develop/use/patterns/indexes/index.md
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,16 +19,36 @@ Redis is not exactly a key-value store, since values can be complex data structu
19
19
20
20
This document explains how it is possible to create indexes in Redis using the following data structures:
21
21
22
+
* Hashes and JSON documents, using a variety of field types; used in conjunction with the Redis query engine.
22
23
* Sorted sets to create secondary indexes by ID or other numerical fields.
23
24
* Sorted sets with lexicographical ranges for creating more advanced secondary indexes, composite indexes and graph traversal indexes.
24
25
* Sets for creating random indexes.
25
26
* Lists for creating simple iterable indexes and last N items indexes.
27
+
* Time series with labels.
26
28
27
29
Implementing and maintaining indexes with Redis is an advanced topic, so most
28
30
users that need to perform complex queries on data should understand if they
29
31
are better served by a relational store. However often, especially in caching
30
32
scenarios, there is the explicit need to store indexed data into Redis in order to speedup common queries which require some form of indexing in order to be executed.
31
33
34
+
## Hashes and JSON indexes
35
+
36
+
The Redis query engine provides capabilities to index and query both hash and JSON keys using a variety of field types:
37
+
38
+
*`TEXT`
39
+
*`TAG`
40
+
*`NUMERIC`
41
+
*`GEO`
42
+
*`VECTOR`
43
+
*`GEOSHAPE`
44
+
45
+
Once hash or JSON keys have been indexed using the [`FT.CREATE`]({{< baseurl >}}/commands/ft.create) command, all keys that use the prefix defined in the index can be queried using the [`FT.SEARCH`]({{< baseurl >}}/commands/ft.search) and [`FT.AGGREGATE`]({{< baseurl >}}/commands/ft.aggregate) commands.
46
+
47
+
For more information on creating hash and JSON indexes, see the following pages.
The simplest secondary index you can create with Redis is by using the
@@ -158,6 +178,14 @@ When representing much larger numbers, you need a different form of indexing
158
178
that is able to index numbers at any precision, called a lexicographical
159
179
index.
160
180
181
+
## Time series indexes
182
+
183
+
When you create a new time series using the [`TS.CREATE`]({{< baseurl >}}/commands/ts.create) command, you can associate one or more `LABELS` with it. Each label is a name-value pair, where the both name and value are text. Labels serve as a secondary index that allows you to execute queries on groups of time series keys using various time series commands.
184
+
185
+
See the [time series quickstart guide]({{< relref "/develop/data-types/timeseries/quickstart#labels" >}}) for an example of creating a time series with a label.
186
+
187
+
The [`TS.MGET`]({{< baseurl >}}/commands/ts.mget), [`TS.MRANGE`]({{< baseurl >}}/commands/ts.mrange), and [`TS.MREVRANGE`]({{< baseurl >}}/commands/ts.mrevrange) commands operate on multiple time series based on specified labels or using a label-related filter expression. The [`TS.QUERYINDEX`]({{< baseurl >}}/commands/ts.queryindex) command returns all time series keys matching a given label-related filter expression.
188
+
161
189
## Lexicographical indexes
162
190
163
191
Redis sorted sets have an interesting property. When elements are added
summary: Redis Data Integration keeps Redis in sync with the primary database in near
13
+
real time.
14
+
type: integration
15
+
weight: 100
16
+
---
17
+
18
+
In the example below, the data is captured from the source table named `employee` and is written to the Redis database as a JSON document. When you specify the `data_type` parameter for the job, it overrides the system-wide setting `target_data_type` defined in `config.yaml`.
19
+
20
+
Here, the result will be Redis JSON documents with fields captured from the source table
21
+
(`employeeid`, `firstname`, `lastname`) and also with
22
+
an extra field `my_opcode` added using the `merge` update strategy (see the
0 commit comments