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/ft.profile.md
+80-38Lines changed: 80 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,11 @@ is the query string, sent to `FT.SEARCH` or `FT.AGGREGATE`.
87
87
88
88
## Return
89
89
90
+
{{< note>}}
91
+
This page contains the up-to-date profile output as of RediSearch v2.8.33, v2.10.26, v8.2.7, and v8.4.3.
92
+
The output format itself may differ between RediSearch versions, and RESP protocol versions.
93
+
{{< /note >}}
94
+
90
95
`FT.PROFILE` returns a two-element array reply. The first element contains the results of the provided `FT.SEARCH` or `FT.AGGREGATE` command.
91
96
The second element contains information about query creation, iterator profiles, and result processor profiles.
92
97
Details of the second element follow in the sections below.
@@ -97,19 +102,22 @@ This section contains query execution details for each shard.
97
102
When more than one shard is in play, the shards will be labeled `Shard #1`, `Shard #2`, etc.
98
103
If there's only one shard, the label will be omitted.
99
104
100
-
| Returned field name | Definition |
101
-
|:-- |:-- |
102
-
|`Total` `profile` `time`| The total run time (ms) of the query. Normally just a few ms. |
103
-
|`Parsing` `time`| The time (ms) spent parsing the query and its parameters into a query plan. Normally just a few ms. |
104
-
|`Pipeline` `creation` `time`| The creation time (ms) of the execution plan, including iterators, result processors, and reducers creation. Normally just a few ms for `FT.SEARCH` queries, but expect a larger number for `FT.AGGREGATE` queries. |
105
-
|`Warning`| Errors that occurred during query execution. |
|`Shard ID`| String containing the unique shard ID. In Redis Open Source, this identifier is denoted as the node ID, and is received from the `RedisModule_GetMyClusterID()` API. (Available as of RediSearch v8.4.3) |
108
+
|`Total` `profile` `time`| The total run time (ms) of the query. Normally just a few ms. |
109
+
|`Parsing` `time`| The time (ms) spent parsing the query and its parameters into a query plan. Normally just a few ms. |
110
+
|`Pipeline` `creation` `time`| The creation time (ms) of the execution plan, including iterators, result processors, and reducers creation. Normally just a few ms for `FT.SEARCH` queries, but expect a larger number for `FT.AGGREGATE` queries. |
111
+
|`Total` `GIL` `time`| In multi-threaded deployments, the total time (ms) the query spent holding and waiting for the Redis Global Lock (referred to as GIL) during execution. Note: this value is only valid in the shards profile section. |
112
+
|`Warning`| Errors that occurred during query execution. |
113
+
|`Internal` `cursor` `reads`| The number of times the coordinator fetched result batches from a given shard during a distributed `AGGREGATE` query in cluster mode. Includes the initial request plus any subsequent batch fetches. |
106
114
107
115
### Iterator profiles
108
116
109
-
This section contains index iterator information, including `Type`, `Query Type`, `Term` (when applicable), `Time` (in ms), `Counter`, `Child iterator`, and `Size` information.
110
-
Each iterator represents an executor for each part of the query plan, nested per the execution plan. The operation types mentioned below (`UNION`, etc) should match up with the provided query.
117
+
This section contains index iterator information, including `Type`, `Query Type`, `Term` (when applicable), `Time` (ms), `Number of reading operations`, `Child iterator`, and `Estimated number of matches` information.
118
+
Each iterator represents an executor for each part of the query plan, nested per the execution plan. The operation types mentioned below (for example, `UNION`) should match up with the provided query.
111
119
112
-
Inverted-index iterators also include the number of elements they contain. Hybrid vector iterators return the top results from the vector index in batches, including the number of batches.
120
+
Inverted-index iterators also include the number of elements they contain. Vector iterators include additional profiling information. See [Notes on Vector iterator profile](#notes-onvector-iterator-profile) below.
113
121
114
122
Iterator types include:
115
123
@@ -121,19 +129,49 @@ Iterator types include:
121
129
*`TAG` with `Term`
122
130
*`NUMERIC` with `Term`
123
131
*`VECTOR`
132
+
*`METRIC - VECTOR DISTANCE`
133
+
*`GEO` with `Term`
124
134
*`EMPTY`
125
135
*`WILDCARD`
126
136
*`OPTIONAL`
137
+
*`OPTIMIZER` with `Optimizer mode` - Query optimization wrapper for `FT.SEARCH` queries sorted by a numeric field. Enabled by default in [DIALECT 4]({{< relref "/develop/ai/search-and-query/advanced-concepts/dialects##dialect-4-deprecated" >}}) or explicitly with `WITHOUTCOUNT`.
138
+
*`ID-LIST` - Iterator over specific document IDs (appears when using `INKEYS`)
139
+
140
+
**Notes on `Number of reading operations` and `Estimated number of matches`**
141
+
142
+
`Number of reading operations` is the number of times an iterator was interacted with. A very high value in comparison to others is a possible warning flag. `NUMERIC` and `Child iterator` types are broken into ranges, and `Number of reading operations` will vary depending on the range. For `UNION`, the sum of the reading operations in child iterators should be equal to or greater than the child iterator's reading operations.
143
+
144
+
`Estimated number of matches` is the size of the document set. `Number of reading operations` should always be equal to or less than `Estimated number of matches`.
145
+
146
+
#### Notes on Vector iterator profile {#notes-onvector-iterator-profile}
147
+
148
+
For vector queries, the iterator profile includes additional information specific to vector search execution.
127
149
128
-
**Notes on `Counter` and `Size`**
150
+
#### Vector search mode
129
151
130
-
Counter is the number of times an iterator was interacted with. A very high value in comparison to others is a possible warning flag. `NUMERIC` and `Child interator` types are broken into ranges, and `Counter` will vary depending on the range. For `UNION`, the sum of the counters in child iterators should be equal or greater than the child iterator’s counters.
152
+
The `Vector search mode` field indicates the execution strategy used for both `VECTOR` and `METRIC - VECTOR DISTANCE`iterator types:
131
153
132
-
`Size` is the size of the document set. `Counter` should always be equal or less than `Size`.
154
+
| Mode | Description |
155
+
|:-- |:-- |
156
+
|`STANDARD_KNN`| Pure KNN vector search without filters. |
157
+
|`RANGE_QUERY`| Range-based vector search. Used with `VECTOR_RANGE` queries. |
158
+
|`HYBRID_ADHOC_BF`| Ad-hoc brute force for filtered queries. Iterates through results that pass the filter and calculates distances on-the-fly. |
159
+
|`HYBRID_BATCHES`| Batch-based filtered search. Retrieves top vectors from the index in batches and checks which ones pass the filter. |
160
+
|`HYBRID_BATCHES_TO_ADHOC_BF`| Dynamic mode switching. Starts with batch-based search but switches to ad-hoc brute force if batch iterations yield insufficient results. |
161
+
162
+
#### Batch execution statistics
163
+
164
+
For queries using batch modes (`HYBRID_BATCHES` or `HYBRID_BATCHES_TO_ADHOC_BF`), additional batch statistics are included:
165
+
166
+
| Returned field name | Definition |
167
+
|:-- |:-- |
168
+
|`Batches number`| Total number of batch iterations executed during the search. |
169
+
|`Largest batch size`| The maximum batch size used during execution. Batch sizes may vary dynamically based on the ratio of estimated matching documents to total index size. |
170
+
|`Largest batch iteration (zero based)`| The iteration number (0-based) when the largest batch occurred. |
133
171
134
172
### Result processor profiles
135
173
136
-
Result processors form a powerful pipeline in Redis Query Engine. They work in stages to gather, filter, score, sort, and return results as efficiently as possible based on complex query needs. Each processor reports `Time` information, which represents the total duration (in milliseconds, or ms) spent by the processor to complete its operation, and `Counter` information, which indicates the number of times the processor was invoked during the query.
174
+
Result processors form a powerful pipeline in Redis Query Engine. They work in stages to gather, filter, score, sort, and return results as efficiently as possible based on complex query needs. Each processor reports `Time` information, which represents the total duration (in milliseconds, or ms) spent by the processor to complete its operation, and `Results processed` information, which indicates the number of times the processor was invoked during the query.
137
175
138
176
| Type | Definition |
139
177
|:-- |:-- |
@@ -142,9 +180,13 @@ Result processors form a powerful pipeline in Redis Query Engine. They work in s
142
180
|`Scorer`| The `Scorer` processor assigns a relevance score to each document based on the query’s specified scoring function. This function could involve factors like term frequency, inverse document frequency, or other weighted metrics. |
143
181
|`Sorter`| The `Sorter` processor arranges the query results based on a specified sorting criterion. This could be a field value (e.g., sorting by price, date, or another attribute) or by the score assigned during the scoring phase. It operates after documents are fetched and scored, ensuring the results are ordered as required by the query (e.g., ascending or descending order). `Scorer` results will always be present in `FT.SEARCH` profiles. |
144
182
|`Loader`| The `Loader` processor retrieves the document contents after the results have been sorted and filtered. It ensures that only the fields specified by the query are loaded, which improves efficiency, especially when dealing with large documents where only a few fields are needed. |
183
+
|`Threadsafe-Loader`| The `Threadsafe-Loader` processor safely loads document contents when the query runs in a background thread (relevant for multi-threaded deployments). It acquires the Redis Global Lock (referred to as GIL) to access document data. Reports an additional `GIL-Time` field representing the time (ms) spent holding the GIL and waiting to acquire it. |
145
184
|`Highlighter`| The `Highlighter` processor is used to highlight matching terms in the search results. This is especially useful for full-text search applications, where relevant terms are often emphasized in the UI. |
146
-
|`Paginator`| The `Paginator` processor is responsible for handling pagination by limiting the results to a specific range (e.g., LIMIT 0 10).It trims down the set of results to fit the required pagination window, ensuring efficient memory usage when dealing with large result sets. |
147
-
|`Vector` `Filter`| For vector searches, the `Vector Filter` processor is sometimes used to pre-process results based on vector similarity thresholds before the main scoring and sorting. |
185
+
|`Pager/Limiter`| The `Pager/Limiter` processor is responsible for handling pagination by limiting the results to a specific range (e.g., LIMIT 0 10).It trims down the set of results to fit the required pagination window, ensuring efficient memory usage when dealing with large result sets. |
186
+
|`Counter`| The `Counter` processor counts the total number of matching results. Used when running queries with `LIMIT 0 0` to return only the count. |
187
+
|`Grouper`| The `Grouper` processor groups results by field values. Used with `GROUPBY` in `FT.AGGREGATE` queries. |
188
+
|`Projector`| The `Projector` processor applies field transformations. Used with `APPLY` in `FT.AGGREGATE` queries. |
189
+
|`Network`| Collects and merges results from shards. Appears as the root processor in the coordinator's result processor chain for `FT.AGGREGATE` in cluster mode. |
148
190
149
191
### Coordinator
150
192
@@ -206,7 +248,7 @@ Here's an example of running the `FT.PROFILE` command for a compound query.
206
248
2) INTERSECT
207
249
3) Time
208
250
4) "0"
209
-
5)Counter
251
+
5)Number of reading operations
210
252
6) (integer) 6
211
253
7) Child iterators
212
254
8)1) Type
@@ -215,7 +257,7 @@ Here's an example of running the `FT.PROFILE` command for a compound query.
215
257
4) UNION
216
258
5) Time
217
259
6) "0"
218
-
7)Counter
260
+
7)Number of reading operations
219
261
8) (integer) 6
220
262
9) Child iterators
221
263
10)1) Type
@@ -224,7 +266,7 @@ Here's an example of running the `FT.PROFILE` command for a compound query.
224
266
4) UNION
225
267
5) Time
226
268
6) "0"
227
-
7)Counter
269
+
7)Number of reading operations
228
270
8) (integer) 4
229
271
9) Child iterators
230
272
10)1) Type
@@ -233,37 +275,37 @@ Here's an example of running the `FT.PROFILE` command for a compound query.
233
275
4) kids
234
276
5) Time
235
277
6) "0"
236
-
7)Counter
278
+
7)Number of reading operations
237
279
8) (integer) 4
238
-
9)Size
280
+
9)Estimated number of matches
239
281
10) (integer) 4
240
282
11)1) Type
241
283
2) TEXT
242
284
3) Term
243
285
4) +kid
244
286
5) Time
245
287
6) "0"
246
-
7)Counter
288
+
7)Number of reading operations
247
289
8) (integer) 4
248
-
9)Size
290
+
9)Estimated number of matches
249
291
10) (integer) 4
250
292
11)1) Type
251
293
2) TEXT
252
294
3) Term
253
295
4) small
254
296
5) Time
255
297
6) "0"
256
-
7)Counter
298
+
7)Number of reading operations
257
299
8) (integer) 2
258
-
9)Size
300
+
9)Estimated number of matches
259
301
10) (integer) 2
260
302
9)1) Type
261
303
2) UNION
262
304
3) Query type
263
305
4) TAG
264
306
5) Time
265
307
6) "0"
266
-
7)Counter
308
+
7)Number of reading operations
267
309
8) (integer) 6
268
310
9) Child iterators
269
311
10)1) Type
@@ -272,44 +314,44 @@ Here's an example of running the `FT.PROFILE` command for a compound query.
272
314
4) new
273
315
5) Time
274
316
6) "0"
275
-
7)Counter
317
+
7)Number of reading operations
276
318
8) (integer) 4
277
-
9)Size
319
+
9)Estimated number of matches
278
320
10) (integer) 10
279
321
11)1) Type
280
322
2) TAG
281
323
3) Term
282
324
4) used
283
325
5) Time
284
326
6) "0"
285
-
7)Counter
327
+
7)Number of reading operations
286
328
8) (integer) 4
287
-
9)Size
329
+
9)Estimated number of matches
288
330
10) (integer) 8
289
331
6)1) Result processors profile
290
332
2)1) Type
291
333
2) Index
292
334
3) Time
293
335
4) "0"
294
-
5)Counter
336
+
5)Results processed
295
337
6) (integer) 3
296
338
3)1) Type
297
339
2) Scorer
298
340
3) Time
299
341
4) "0"
300
-
5)Counter
342
+
5)Results processed
301
343
6) (integer) 3
302
344
4)1) Type
303
345
2) Sorter
304
346
3) Time
305
347
4) "0"
306
-
5)Counter
348
+
5)Results processed
307
349
6) (integer) 3
308
350
5)1) Type
309
351
2) Loader
310
352
3) Time
311
353
4) "0"
312
-
5)Counter
354
+
5)Results processed
313
355
6) (integer) 3
314
356
{{< / highlight >}}
315
357
</details>
@@ -366,32 +408,32 @@ Here's an example of running the `FT.PROFILE` command for a vector query.
0 commit comments