How to read the EXPLAIN execution plan and output of PROFILE?
Last updated 22, Mar 2024
Question
How to read the EXPLAIN execution plan and output of PROFILE?
Answer
Let's consider the following explain plan of a hybrid vector similarity search query that performs also a full-text search and a tag search.
FT.EXPLAIN doc_idx (@content:(carbonara) @genre:{technical})=>[KNN 2 @embedding $vec AS score]
RETURN 1 score
DIALECT 2
LIMIT 0 10
params 2 vec \x0e\xaf\xae<\xac\x92\x96< [...]
This is the output produced by the FT.EXPLAIN
command:
VECTOR {
INTERSECT {
@content:carbonara
TAG:@genre {
technical
}
}
} => {K=2 nearest vectors to `$vec` in vector index associated with field @embedding, yields distance as `score`}
The internal section (the INTERSECT
, in this example) is a pre-filter and returns the KNN results from the induced sub-space. This holds for both FLAT
and HNSW
indexing methods.
The FT.PROFILE
command of this same query, instead, would return the following output.
(Result{0 total, docs: []}, {'Total profile time': 1.0, 'Parsing time': 1.0, 'Pipeline creation time': 0.0, 'Iterators profile': {'Type': 'VECTOR', 'Time': 0.0, 'Counter': 0.0, 'Child iterators': [{'Type': 'INTERSECT', 'Time': 0.0, 'Counter': 0.0, 'Child iterators': [{'Type': 'TEXT', 'Term': 'carbonara', 'Time': 0.0, 'Counter': 4.0, 'Size': 4.0}, {'Type': 'TAG', 'Term': 'technical', 'Time': 0.0, 'Counter': 3.0, 'Size': 4.0}]}]}, 'Result processors profile': {'Type': 'Index', 'Time': 0.0, 'Counter': 0.0}})
References
Learn more about the FT.EXPLAIN and FT.INFO commands.