메서드를 사용하여 MongoDB Vector Search 쿼리 explain 실행 쿼리 쿼리 내부적으로 실행 된 방식을 설명하는 실행 쿼리 계획 계획이 포함된 BSON 문서반환합니다.
구문
db.<myCollection>.explain("<verbosity>").aggregate([ { "$vectorSearch": { "exact": true | false, "filter": {<filter-specification>}, "index": "<index-name>", "limit": <number-of-results>, "numCandidates": <number-of-candidates>, "path": "<field-to-search>", "queryVector": [<array-of-numbers>], "explainOptions": { "traceDocumentIds": [<array-of-document-IDs>] } } } ])
상세
상세 모드 explain 의 동작과 반환되는 정보의 양을 제어합니다. 값은 상세도가 낮은 순서대로 다음 중 하나일 수 있습니다.
쿼리에 대한 실행 쿼리 가 포함된 | |
쿼리에 대한 실행 통계가 포함된 | |
queryPlanner(기본값) | 쿼리 계획에 대한 정보입니다. 쿼리에 대한 실행 통계를 포함하는 |
결과 설명
explain 메서드는 다음 필드가 있는 BSON 문서 반환합니다.
옵션 | 유형 | 필요성 | 목적 |
|---|---|---|---|
| 문서 | 옵션 | 수집기에 대한 실행 통계를 설명합니다. |
| 문서 | 옵션 | 유용한 메타데이터를 포함합니다. |
| 문서 | 옵션 | 쿼리 에 대한 실행 통계를 설명합니다. 이는 |
| 문서 | 옵션 | 쿼리 실행 후 문서별 데이터 검색과 관련된 세부 정보입니다. |
| 문서 | 옵션 | 쿼리가 실행되었을 때 쿼리의 리소스 사용량 세부 정보를 제공합니다. |
| 객체 배열 | 옵션 | 지정된 문서의 벡터에 대한 다음과 같은 세부 정보를 추적합니다.
|
| 객체 배열 | 옵션 | 쿼리 실행의 |
collectors
collectors 은 다음 필드 있는 BSON 문서 입니다.
필드 | 유형 | 필요성 | 목적 |
|---|---|---|---|
| 문서 | 필수 사항 | 쿼리 의 모든 수집기 통계입니다. 보고된 통계는 쿼리 에 사용된 모든 수집기의 최대값 또는 모든 하위 수집기의 통계 합계를 나타냅니다. 타이밍 통계는 전체 쿼리 에 대해 모든 수집기에서 소요된 총 시간을 반영하기 위해 합산됩니다. 자세한 학습 은 |
allCollectorStats
allCollectorStats 은 쿼리 에 지정된 모든 수집기의 수집기 통계를 설명하는 BSON 문서 입니다. 여기에는 다음과 같은 키가 포함되어 있습니다.
필드 | 설명 |
|---|---|
| 수집기가 수집한 결과의 지속 시간과 수량을 추적합니다. |
| 수집기에서 |
| 수집기에 설정된 점수 계산기의 총 지속 시간과 횟수를 추적하는 통계입니다. |
metadata
metadata는 다음과 같은 유용한 메타데이터를 포함합니다.
필드 | 유형 | 필요성 | 목적 |
|---|---|---|---|
| 문자열 | 옵션 |
|
| 문자열 | 옵션 |
|
| 문자열 | 옵션 | 쿼리 에 사용된 MongoDB Vector Search 인덱스 . |
| 문서 | 옵션 |
|
| Integer | 옵션 | 삭제된 문서를 포함하여 인덱스 에 있는 총 문서 수입니다. |
query
explain 응답은 쿼리의 실행 통계를 설명하는 키와 값이 포함된 BSON 문서입니다. 결과 세트의 explain 문서에는 다음 필드가 포함되어 있습니다.
필드 | 유형 | 필요성 | 목적 |
|---|---|---|---|
| 문자열 | 옵션 | 루트가 아닌 경우에만 쿼리된 임베딩 필드 의 경로입니다. |
| 문자열 | 필수 사항 | 벡터 검색 쿼리 유형의 이름입니다. 자세한 내용은 |
| 문서 | 필수 사항 | 벡터 검색 쿼리 정보입니다. 자세한 내용은 |
| 문서 | 옵션 |
|
args
설명 응답 에는 쿼리 내부적으로 실행된 방식에 대한 정보가 포함되어 있습니다. args 필드 에는 다음과 같은 세부 정보가 포함되어 있습니다.
쿼리 유형
각 쿼리 유형에 대한 구조화된 요약 예시
구조화된 요약의 쿼리 옵션
다음 섹션에서는 구조화된 요약의 쿼리 유형과 필드에 대해 설명합니다.
WrappedKnnQuery여러 쿼리를 결합하는 ANN 벡터 검색에 사용되는 래퍼 쿼리입니다. 구조화된 요약에는 다음 옵션에 대한 세부 정보가 포함되어 있습니다.
필드유형필요성설명query배열
필수 사항
벡터 검색 에 사용되는 하위 쿼리의 배열로, 일반적으로
KnnFloatVectorQuery및DocAndScoreQuery를 포함합니다.
KnnFloatVectorQuery부동 소수점 벡터에 대한 ANN 검색과 관련된 쿼리 유형입니다. 구조화된 요약에는 다음 옵션에 대한 세부 정보가 포함되어 있습니다.
필드유형필요성설명field문자열
필수 사항
검색 중인 벡터 필드 경로 .
kInteger
필수 사항
조회 할 가장 가까운 이웃의 수입니다.
ExactVectorSearchQueryENN 벡터 검색을 위한 쿼리 유형입니다. 구조화된 요약에는 다음 옵션에 대한 세부 정보가 포함되어 있습니다.
필드유형필요성설명field문자열
필수 사항
검색 중인 벡터 필드 경로 .
similarityFunction문자열
필수 사항
사용된 유사성 함수(
dotProduct,cosine또는euclidean)입니다.filter문서
옵션
벡터 검색 범위를 제한하는 사전 필터 쿼리 .
BooleanQuery벡터 검색 쿼리 에서 사전 필터를 사용하는 경우 설명 결과에
BooleanQuery유형이 포함됩니다. 이 유형의 필드 및 사전 필터 쿼리 와 관련된 기타 쿼리 유형에 대해 자세히 학습하려면 MongoDB 검색 설명 페이지의 쿼리 유형을 참조하세요.
stats
executionStats 및 allPlansExecution 상세도 모드에 대한 explain 응답에는 stats 쿼리가 쿼리 실행의 다양한 단계 에서 소비하는 시간 에 대한 정보가 포함된 필드가 포함되어 있습니다.
타이밍 분석
타이밍 분석은 쿼리 실행 영역 과 관련된 실행 통계를 설명합니다. 다음 필드에는 타이밍 분석이 표시됩니다.
쿼리 영역
다음 쿼리 영역에 대한 통계를 사용할 수 있습니다.
resourceUsage
resourceUsage 문서는 쿼리 실행에 사용된 리소스를 보여줍니다. 다음 필드를 포함합니다.
필드 | 유형 | 필요성 | 목적 |
|---|---|---|---|
| Long | 필수 사항 | 쿼리 실행 중 시스템이 메모리에서 필요한 데이터를 찾지 못해 디스크와 같은 백업 저장소에서 읽게 될 때 발생하는 주요 페이지 폴트 수입니다. |
| Long | 필수 사항 | 데이터가 페이지 캐시에 있지만 아직 프로세스의 페이지 테이블에 매핑되지 않은 경우 발생하는 경미한 페이지 폴트의 수입니다. |
| Long | 필수 사항 | 사용자 공간에서 소요된 CPU 시간(밀리초)입니다. |
| Long | 필수 사항 | 시스템 공간에서 소요된 CPU 시간(단위: 밀리초)입니다. |
| Integer | 필수 사항 | 모든 배치에서 쿼리 실행 중 |
| Integer | 필수 사항 | 쿼리 처리 시 요청된 |
vectorTracing
vectorTracing 배열 에는 문서 당 하나씩 객체 목록이 포함되며 문서 의 벡터에 대한 다음 세부 정보를 포함합니다.
필드 | 유형 | 필요성 | 목적 |
|---|---|---|---|
| 부울 | 필수 사항 | 쿼리 실행 중에 추적된 벡터를 방문했는지 여부를 지정하는 플래그입니다. |
| 문자열 | 조건부 | 벡터를 삭제하는 이유입니다. 이는 벡터를 방문하여 결과에서 삭제한 경우에만 표시됩니다. 값은 다음과 같습니다.
|
| Double | 조건부 | 벡터와 관련된 점수입니다. 이는 벡터를 방문한 경우에만 표시됩니다. |
| Integer | 필수 사항 | 벡터가 속한 루센 세그먼트 번호입니다. 자세한 학습 |
| 부울 | 조건부 | 벡터에 연결할 수 없는지 여부를 지정하는 플래그입니다. 이는 벡터에 연결할 수 없는 경우에만 존재합니다. |
luceneVectorSegmentStats
luceneVectorSegmentStats 객체의 배열 에는 쿼리 실행에 대한 루센 세그먼트별 분석이 포함되어 $vectorSearch 있습니다. 각 세그먼트는 숫자로 식별되며 쿼리 실행 세부 정보를 설명하는 매개변수를 포함합니다.
{ "0": { "executionType": "Approximate", "approximateTimeMillis": 0.10825, "filterMatchedDocsCount": 0, "docCount": 100 }, "1": { "executionType": "Exact", "exactTimeMillis": 0.10825, "filterMatchedDocsCount": 0, "docCount": 55 }, "2": { "executionType": "ApproximateToExactFallback", "approximateTimeMillis": 0.10825, "exactTimeMillis": 0.10825, "filterMatchedDocsCount": 0, "docCount": 55 } }
필드 | 유형 | 필요성 | 목적 |
|---|---|---|---|
| 문자열 | 필수 사항 | 실행 전략. 값은 다음 중 하나일 수 있습니다.
|
| Float | 조건부 | 대략적인 단계의 시간(밀리초)입니다. |
| Float | 조건부 | 정확함 단계의 시간(밀리초)입니다. |
| Integer | 옵션 | 쿼리 에 사전 필터를 지정한 경우 쿼리 필터하다 와 일치하는 문서 수입니다. |
| Integer | 필수 사항 | 세그먼트에 있는 총 문서 수입니다. |
예시
다음 예제에서는 샘플 ANN 및 ENN 쿼리에 explain 메서드를 사용합니다. 자신의 환경에서 다음 예제를 실행 하려면 먼저 을(를) 사용하여 MongoDB Vector Search 빠른 시작을 완료해야 mongosh 합니다.
allPlansExecution
다음 예시 상세도 모드 사용하여 필드 plot_embedding_voyage_3_large 에 대한 ANN 및 ENN 벡터 검색 쿼리 allPlansExecution 에서 explain 메서드를 실행합니다.
db.embedded_movies.explain("allPlansExecution").aggregate([ { "$vectorSearch": { "index": "vector_index", "path": "plot_embedding_voyage_3_large", "queryVector": QUERY_EMBEDDING, "numCandidates": 150, "limit": 10 } } ])
1 { 2 explainVersion: '1', 3 stages: [ 4 { 5 '$vectorSearch': { 6 index: 'vector_index', 7 path: 'plot_embedding_voyage_3_large', 8 queryVector: 'redacted', 9 numCandidates: 150, 10 limit: 10, 11 explain: { 12 query: { 13 type: 'WrappedKnnQuery', 14 args: { 15 query: [ 16 { 17 type: 'InstrumentableKnnFloatVectorQuery', 18 args: { 19 field: '$type:knnVector/plot_embedding_voyage_3_large', 20 k: 150 21 }, 22 stats: { 23 context: { millisElapsed: 0 }, 24 match: { millisElapsed: 0 }, 25 score: { millisElapsed: 0 } 26 } 27 }, 28 { 29 type: 'DocAndScoreQuery', 30 args: {}, 31 stats: { 32 context: { 33 millisElapsed: 1.378949, 34 invocationCounts: { 35 createWeight: Long('1'), 36 createScorer: Long('4') 37 } 38 }, 39 match: { 40 millisElapsed: 0.341389, 41 invocationCounts: { nextDoc: Long('152') } 42 }, 43 score: { 44 millisElapsed: 0.205415, 45 invocationCounts: { 46 score: Long('150'), 47 setMinCompetitiveScore: Long('26') 48 } 49 } 50 } 51 } 52 ] 53 }, 54 stats: { 55 context: { 56 millisElapsed: 57.285674, 57 invocationCounts: { 58 vectorExecution: Long('1'), 59 createWeight: Long('1'), 60 createScorer: Long('4') 61 } 62 }, 63 match: { 64 millisElapsed: 0.341389, 65 invocationCounts: { nextDoc: Long('152') } 66 }, 67 score: { 68 millisElapsed: 0.205415, 69 invocationCounts: { 70 score: Long('150'), 71 setMinCompetitiveScore: Long('26') 72 } 73 } 74 } 75 }, 76 collectors: { 77 allCollectorStats: { 78 millisElapsed: 0.840381, 79 invocationCounts: { 80 collect: Long('150'), 81 competitiveIterator: Long('2'), 82 setScorer: Long('2') 83 } 84 } 85 }, 86 metadata: { 87 mongotVersion: '1.54.0', 88 mongotHostName: '<hostname>.mongodb.net', 89 indexName: 'vector_index', 90 lucene: { totalSegments: 2, totalDocs: 3483 } 91 }, 92 resourceUsage: { 93 majorFaults: Long('0'), 94 minorFaults: Long('0'), 95 userTimeMs: Long('0'), 96 systemTimeMs: Long('0'), 97 maxReportingThreads: 1, 98 numBatches: 1 99 }, 100 luceneVectorSegmentStats: [ 101 { 102 id: '_0', 103 executionType: 'Approximate', 104 docCount: 1952, 105 approximateStage: { millisElapsed: 32.916505 } 106 }, 107 { 108 id: '_1', 109 executionType: 'Approximate', 110 docCount: 1531, 111 approximateStage: { millisElapsed: 8.661519 } 112 } 113 ] 114 } 115 }, 116 nReturned: Long('10'), 117 executionTimeMillisEstimate: Long('256') 118 }, 119 { 120 '$_internalSearchIdLookup': { 121 limit: Long('10'), 122 subPipeline: [ 123 { '$match': { _id: { '$eq': '_id placeholder' } } } 124 ], 125 totalDocsExamined: Long('10'), 126 totalKeysExamined: Long('10'), 127 numDocsFilteredByIdLookup: Long('0') 128 }, 129 nReturned: Long('10'), 130 executionTimeMillisEstimate: Long('256') 131 } 132 ], 133 queryShapeHash: '2E39BED257F2B59D3F8652E1A81A18B1140602C4E253DED9FE208D584EA00083', 134 serverInfo: { 135 host: '<hostname>.mongodb.net', 136 port: 27017, 137 version: '8.2.1-rc1', 138 gitVersion: '3312bdcf28aa65f5930005e21c2cb130f648b8c3' 139 }, 140 serverParameters: { 141 internalQueryFacetBufferSizeBytes: 104857600, 142 internalQueryFacetMaxOutputDocSizeBytes: 104857600, 143 internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600, 144 internalDocumentSourceGroupMaxMemoryBytes: 104857600, 145 internalQueryMaxBlockingSortMemoryUsageBytes: 104857600, 146 internalQueryProhibitBlockingMergeOnMongoS: 0, 147 internalQueryMaxAddToSetBytes: 104857600, 148 internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600, 149 internalQueryFrameworkControl: 'trySbeRestricted', 150 internalQueryPlannerIgnoreIndexWithCollationForRegex: 1 151 }, 152 command: { 153 aggregate: 'embedded_movies', 154 pipeline: [ 155 { 156 '$vectorSearch': { 157 index: 'vector_index', 158 path: 'plot_embedding_voyage_3_large', 159 queryVector: [ 160 -0.034731735, 0.008558298, -0.0153717, -0.029912498, 0.011549547, 161 ..., 162 -0.006688767, 0.047527634, 0.040714234 163 ], 164 numCandidates: 150, 165 limit: 10 166 } 167 } 168 ], 169 cursor: {}, 170 '$db': 'sample_mflix' 171 }, 172 ok: 1, 173 '$clusterTime': { 174 clusterTime: Timestamp({ t: 1759341228, i: 32 }), 175 signature: { 176 hash: Binary.createFromBase64('BsaUr/khHU1Fyl5/g8htqoavlU8=', 0), 177 keyId: Long('7553982574624768005') 178 } 179 }, 180 operationTime: Timestamp({ t: 1759341228, i: 32 }) 181 }
db.embedded_movies.explain("allPlansExecution").aggregate([ { "$vectorSearch": { "index": "vector_index", "path": "plot_embedding_voyage_3_large", "queryVector": QUERY_EMBEDDING, "exact": true, "limit": 10 } } ])
{ explainVersion: '1', stages: [ { '$vectorSearch': { index: 'vector_index', path: 'plot_embedding_voyage_3_large', queryVector: 'redacted', exact: true, limit: 10, explain: { query: { type: 'ExactVectorSearchQuery', args: { field: '$type:knnVector/plot_embedding_voyage_3_large', similarityFunction: 'dotProduct', filter: { type: 'DefaultQuery', args: { queryType: 'FieldExistsQuery' }, stats: { context: { millisElapsed: 0.756254, invocationCounts: { createWeight: Long('1'), createScorer: Long('4') } }, match: { millisElapsed: 3.835071, invocationCounts: { nextDoc: Long('3405') } }, score: { millisElapsed: 0 } } } }, stats: { context: { millisElapsed: 1.271846, invocationCounts: { createWeight: Long('1'), createScorer: Long('4') } }, match: { millisElapsed: 7.699638, invocationCounts: { nextDoc: Long('3405') } }, score: { millisElapsed: 139.077653, invocationCounts: { score: Long('3403'), setMinCompetitiveScore: Long('63') } } } }, collectors: { allCollectorStats: { millisElapsed: 146.798572, invocationCounts: { collect: Long('3403'), competitiveIterator: Long('2'), setScorer: Long('2') } } }, metadata: { mongotVersion: '1.54.0', mongotHostName: '<hostname>.mongodb.net', indexName: 'vector_index', lucene: { totalSegments: 2, totalDocs: 3483 } }, resourceUsage: { majorFaults: Long('0'), minorFaults: Long('0'), userTimeMs: Long('0'), systemTimeMs: Long('0'), maxReportingThreads: 1, numBatches: 1 } } }, nReturned: Long('10'), executionTimeMillisEstimate: Long('208') }, { '$_internalSearchIdLookup': { limit: Long('10'), subPipeline: [ { '$match': { _id: { '$eq': '_id placeholder' } } } ], totalDocsExamined: Long('10'), totalKeysExamined: Long('10'), numDocsFilteredByIdLookup: Long('0') }, nReturned: Long('10'), executionTimeMillisEstimate: Long('208') } ], queryShapeHash: '2E39BED257F2B59D3F8652E1A81A18B1140602C4E253DED9FE208D584EA00083', serverInfo: { host: '<hostname>.mongodb.net', port: 27017, version: '8.2.1-rc1', gitVersion: '3312bdcf28aa65f5930005e21c2cb130f648b8c3' }, serverParameters: { internalQueryFacetBufferSizeBytes: 104857600, internalQueryFacetMaxOutputDocSizeBytes: 104857600, internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600, internalDocumentSourceGroupMaxMemoryBytes: 104857600, internalQueryMaxBlockingSortMemoryUsageBytes: 104857600, internalQueryProhibitBlockingMergeOnMongoS: 0, internalQueryMaxAddToSetBytes: 104857600, internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600, internalQueryFrameworkControl: 'trySbeRestricted', internalQueryPlannerIgnoreIndexWithCollationForRegex: 1 }, command: { aggregate: 'embedded_movies', pipeline: [ { '$vectorSearch': { index: 'vector_index', path: 'plot_embedding_voyage_3_large', queryVector: [ -0.034731735, 0.008558298, -0.0153717, -0.029912498, 0.011549547, ..., -0.006688767, 0.047527634, 0.040714234 ], exact: true, limit: 10 } } ], cursor: {}, '$db': 'sample_mflix' }, ok: 1, '$clusterTime': { clusterTime: Timestamp({ t: 1759341655, i: 1 }), signature: { hash: Binary.createFromBase64('/pUN/IbVV/OKyakbZcIug8HRS8M=', 0), keyId: Long('7553982574624768005') } }, operationTime: Timestamp({ t: 1759341655, i: 1 }) }
queryPlanner
다음 예시 상세도 모드 사용하여 필드 plot_embedding_voyage_3_large 에 대한 ANN 및 ENN 벡터 검색 쿼리 queryPlanner 에서 explain 메서드를 실행합니다.
db.embedded_movies.explain("queryPlanner").aggregate([ { "$vectorSearch": { "index": "vector_index", "path": "plot_embedding_voyage_3_large", "queryVector": QUERY_EMBEDDING, "numCandidates": 150, "limit": 10 } } ])
{ explainVersion: '1', stages: [ { '$vectorSearch': { index: 'vector_index', path: 'plot_embedding_voyage_3_large', queryVector: 'redacted', numCandidates: 150, limit: 10, explain: { query: { type: 'WrappedKnnQuery', args: { query: [ { type: 'InstrumentableKnnFloatVectorQuery', args: { field: '$type:knnVector/plot_embedding_voyage_3_large', k: 150 } }, { type: 'DocAndScoreQuery', args: {} } ] } }, metadata: { mongotVersion: '1.54.0', mongotHostName: '<hostname>.mongodb.net', indexName: 'vector_index', lucene: { totalSegments: 2, totalDocs: 3483 } } } } }, { '$_internalSearchIdLookup': { limit: Long('10'), subPipeline: [ { '$match': { _id: { '$eq': '_id placeholder' } } } ] } } ], queryShapeHash: '2E39BED257F2B59D3F8652E1A81A18B1140602C4E253DED9FE208D584EA00083', serverInfo: { host: '<hostname>.mongodb.net', port: 27017, version: '8.2.1-rc1', gitVersion: '3312bdcf28aa65f5930005e21c2cb130f648b8c3' }, serverParameters: { internalQueryFacetBufferSizeBytes: 104857600, internalQueryFacetMaxOutputDocSizeBytes: 104857600, internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600, internalDocumentSourceGroupMaxMemoryBytes: 104857600, internalQueryMaxBlockingSortMemoryUsageBytes: 104857600, internalQueryProhibitBlockingMergeOnMongoS: 0, internalQueryMaxAddToSetBytes: 104857600, internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600, internalQueryFrameworkControl: 'trySbeRestricted', internalQueryPlannerIgnoreIndexWithCollationForRegex: 1 }, command: { aggregate: 'embedded_movies', pipeline: [ { '$vectorSearch': { index: 'vector_index', path: 'plot_embedding_voyage_3_large', queryVector: [ -0.034731735, 0.008558298, -0.0153717, -0.029912498, 0.011549547, ..., -0.006688767, 0.047527634, 0.040714234 ], numCandidates: 150, limit: 10 } } ], cursor: {}, '$db': 'sample_mflix' }, ok: 1, '$clusterTime': { clusterTime: Timestamp({ t: 1759341765, i: 1 }), signature: { hash: Binary.createFromBase64('rPjwbtfbjVrbcvkkN0ct/b1UYa8=', 0), keyId: Long('7553982574624768005') } }, operationTime: Timestamp({ t: 1759341765, i: 1 }) }
db.embedded_movies.explain("queryPlanner").aggregate([ { "$vectorSearch": { "index": "vector_index", "path": "plot_embedding_voyage_3_large", "queryVector": QUERY_EMBEDDING, "exact": true, "limit": 10 } } ])
{ explainVersion: '1', stages: [ { '$vectorSearch': { index: 'vector_index', path: 'plot_embedding_voyage_3_large', queryVector: 'redacted', exact: true, limit: 10, explain: { query: { type: 'ExactVectorSearchQuery', args: { field: '$type:knnVector/plot_embedding_voyage_3_large', similarityFunction: 'dotProduct', filter: { type: 'DefaultQuery', args: { queryType: 'FieldExistsQuery' } } } }, metadata: { mongotVersion: '1.54.0', mongotHostName: '<hostname>.mongodb.net', indexName: 'vector_index', lucene: { totalSegments: 2, totalDocs: 3483 } } } } }, { '$_internalSearchIdLookup': { limit: Long('10'), subPipeline: [ { '$match': { _id: { '$eq': '_id placeholder' } } } ] } } ], queryShapeHash: '2E39BED257F2B59D3F8652E1A81A18B1140602C4E253DED9FE208D584EA00083', serverInfo: { host: '<hostname>.mongodb.net', port: 27017, version: '8.2.1-rc1', gitVersion: '3312bdcf28aa65f5930005e21c2cb130f648b8c3' }, serverParameters: { internalQueryFacetBufferSizeBytes: 104857600, internalQueryFacetMaxOutputDocSizeBytes: 104857600, internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600, internalDocumentSourceGroupMaxMemoryBytes: 104857600, internalQueryMaxBlockingSortMemoryUsageBytes: 104857600, internalQueryProhibitBlockingMergeOnMongoS: 0, internalQueryMaxAddToSetBytes: 104857600, internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600, internalQueryFrameworkControl: 'trySbeRestricted', internalQueryPlannerIgnoreIndexWithCollationForRegex: 1 }, command: { aggregate: 'embedded_movies', pipeline: [ { '$vectorSearch': { index: 'vector_index', path: 'plot_embedding_voyage_3_large', queryVector: [ -0.034731735, 0.008558298, -0.0153717, -0.029912498, 0.011549547, ..., -0.006688767, 0.047527634, 0.040714234 ], exact: true, limit: 10 } } ], cursor: {}, '$db': 'sample_mflix' }, ok: 1, '$clusterTime': { clusterTime: Timestamp({ t: 1759342075, i: 1 }), signature: { hash: Binary.createFromBase64('jQiwcAMEmfzFnVU/pyb29TnYu0w=', 0), keyId: Long('7553982574624768005') } }, operationTime: Timestamp({ t: 1759342075, i: 1 }) }
executionStats
다음 예시 상세도 모드 사용하여 필드 plot_embedding_voyage_3_large 에 대한 ANN 및 ENN 벡터 검색 쿼리 executionStats 에서 explain 메서드를 실행합니다.
db.embedded_movies.explain("executionStats").aggregate([ { "$vectorSearch": { "index": "vector_index", "path": "plot_embedding_voyage_3_large", "queryVector": QUERY_EMBEDDING, "numCandidates": 150, "limit": 10 } } ])
{ explainVersion: '1', stages: [ { '$vectorSearch': { index: 'vector_index', path: 'plot_embedding_voyage_3_large', queryVector: 'redacted', numCandidates: 150, limit: 10, explain: { query: { type: 'WrappedKnnQuery', args: { query: [ { type: 'InstrumentableKnnFloatVectorQuery', args: { field: '$type:knnVector/plot_embedding_voyage_3_large', k: 150 }, stats: { context: { millisElapsed: 0 }, match: { millisElapsed: 0 }, score: { millisElapsed: 0 } } }, { type: 'DocAndScoreQuery', args: {}, stats: { context: { millisElapsed: 0.013013, invocationCounts: { createWeight: Long('1'), createScorer: Long('4') } }, match: { millisElapsed: 0.459619, invocationCounts: { nextDoc: Long('152') } }, score: { millisElapsed: 0.179147, invocationCounts: { score: Long('150'), setMinCompetitiveScore: Long('26') } } } } ] }, stats: { context: { millisElapsed: 7.113224, invocationCounts: { vectorExecution: Long('1'), createWeight: Long('1'), createScorer: Long('4') } }, match: { millisElapsed: 0.459619, invocationCounts: { nextDoc: Long('152') } }, score: { millisElapsed: 0.179147, invocationCounts: { score: Long('150'), setMinCompetitiveScore: Long('26') } } } }, collectors: { allCollectorStats: { millisElapsed: 0.868815, invocationCounts: { collect: Long('150'), competitiveIterator: Long('2'), setScorer: Long('2') } } }, metadata: { mongotVersion: '1.54.0', mongotHostName: '<hostname>.mongodb.net', indexName: 'vector_index', lucene: { totalSegments: 2, totalDocs: 3483 } }, resourceUsage: { majorFaults: Long('0'), minorFaults: Long('0'), userTimeMs: Long('0'), systemTimeMs: Long('0'), maxReportingThreads: 1, numBatches: 1 }, luceneVectorSegmentStats: [ { id: '_1', executionType: 'Approximate', docCount: 1531, approximateStage: { millisElapsed: 2.58089 } }, { id: '_0', executionType: 'Approximate', docCount: 1952, approximateStage: { millisElapsed: 3.483542 } } ] } }, nReturned: Long('10'), executionTimeMillisEstimate: Long('29') }, { '$_internalSearchIdLookup': { limit: Long('10'), subPipeline: [ { '$match': { _id: { '$eq': '_id placeholder' } } } ], totalDocsExamined: Long('10'), totalKeysExamined: Long('10'), numDocsFilteredByIdLookup: Long('0') }, nReturned: Long('10'), executionTimeMillisEstimate: Long('30') } ], queryShapeHash: '2E39BED257F2B59D3F8652E1A81A18B1140602C4E253DED9FE208D584EA00083', serverInfo: { host: '<hostname>.mongodb.net', port: 27017, version: '8.2.1-rc1', gitVersion: '3312bdcf28aa65f5930005e21c2cb130f648b8c3' }, serverParameters: { internalQueryFacetBufferSizeBytes: 104857600, internalQueryFacetMaxOutputDocSizeBytes: 104857600, internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600, internalDocumentSourceGroupMaxMemoryBytes: 104857600, internalQueryMaxBlockingSortMemoryUsageBytes: 104857600, internalQueryProhibitBlockingMergeOnMongoS: 0, internalQueryMaxAddToSetBytes: 104857600, internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600, internalQueryFrameworkControl: 'trySbeRestricted', internalQueryPlannerIgnoreIndexWithCollationForRegex: 1 }, command: { aggregate: 'embedded_movies', pipeline: [ { '$vectorSearch': { index: 'vector_index', path: 'plot_embedding_voyage_3_large', queryVector: [ -0.034731735, 0.008558298, -0.0153717, -0.029912498, 0.011549547, ..., -0.006688767, 0.047527634, 0.040714234 ], numCandidates: 150, limit: 10 } } ], cursor: {}, '$db': 'sample_mflix' }, ok: 1, '$clusterTime': { clusterTime: Timestamp({ t: 1759342175, i: 1 }), signature: { hash: Binary.createFromBase64('AZZrjVPfyyBofyQq/gzs9UBL+/Q=', 0), keyId: Long('7553982574624768005') } }, operationTime: Timestamp({ t: 1759342175, i: 1 }) }
db.embedded_movies.explain("executionStats").aggregate([ { "$vectorSearch": { "index": "vector_index", "path": "plot_embedding_voyage_3_large", "queryVector": QUERY_EMBEDDING, "exact": true, "limit": 10 } } ])
{ explainVersion: '1', stages: [ { '$vectorSearch': { index: 'vector_index', path: 'plot_embedding_voyage_3_large', queryVector: 'redacted', exact: true, limit: 10, explain: { query: { type: 'ExactVectorSearchQuery', args: { field: '$type:knnVector/plot_embedding_voyage_3_large', similarityFunction: 'dotProduct', filter: { type: 'DefaultQuery', args: { queryType: 'FieldExistsQuery' }, stats: { context: { millisElapsed: 0.037129, invocationCounts: { createWeight: Long('1'), createScorer: Long('4') } }, match: { millisElapsed: 1.128957, invocationCounts: { nextDoc: Long('3405') } }, score: { millisElapsed: 0 } } } }, stats: { context: { millisElapsed: 0.061268, invocationCounts: { createWeight: Long('1'), createScorer: Long('4') } }, match: { millisElapsed: 2.531393, invocationCounts: { nextDoc: Long('3405') } }, score: { millisElapsed: 7.956341, invocationCounts: { score: Long('3403'), setMinCompetitiveScore: Long('63') } } } }, collectors: { allCollectorStats: { millisElapsed: 10.004281, invocationCounts: { collect: Long('3403'), competitiveIterator: Long('2'), setScorer: Long('2') } } }, metadata: { mongotVersion: '1.54.0', mongotHostName: '<hostname>.mongodb.net', indexName: 'vector_index', lucene: { totalSegments: 2, totalDocs: 3483 } }, resourceUsage: { majorFaults: Long('0'), minorFaults: Long('0'), userTimeMs: Long('0'), systemTimeMs: Long('0'), maxReportingThreads: 1, numBatches: 1 } } }, nReturned: Long('10'), executionTimeMillisEstimate: Long('25') }, { '$_internalSearchIdLookup': { limit: Long('10'), subPipeline: [ { '$match': { _id: { '$eq': '_id placeholder' } } } ], totalDocsExamined: Long('10'), totalKeysExamined: Long('10'), numDocsFilteredByIdLookup: Long('0') }, nReturned: Long('10'), executionTimeMillisEstimate: Long('26') } ], queryShapeHash: '2E39BED257F2B59D3F8652E1A81A18B1140602C4E253DED9FE208D584EA00083', serverInfo: { host: '<hostname>.mongodb.net', port: 27017, version: '8.2.1-rc1', gitVersion: '3312bdcf28aa65f5930005e21c2cb130f648b8c3' }, serverParameters: { internalQueryFacetBufferSizeBytes: 104857600, internalQueryFacetMaxOutputDocSizeBytes: 104857600, internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600, internalDocumentSourceGroupMaxMemoryBytes: 104857600, internalQueryMaxBlockingSortMemoryUsageBytes: 104857600, internalQueryProhibitBlockingMergeOnMongoS: 0, internalQueryMaxAddToSetBytes: 104857600, internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600, internalQueryFrameworkControl: 'trySbeRestricted', internalQueryPlannerIgnoreIndexWithCollationForRegex: 1 }, command: { aggregate: 'embedded_movies', pipeline: [ { '$vectorSearch': { index: 'vector_index', path: 'plot_embedding_voyage_3_large', queryVector: [ -0.034731735, 0.008558298, -0.0153717, -0.029912498, 0.011549547, ..., -0.006688767, 0.047527634, 0.040714234 ], exact: true, limit: 10 } } ], cursor: {}, '$db': 'sample_mflix' }, ok: 1, '$clusterTime': { clusterTime: Timestamp({ t: 1759342255, i: 1 }), signature: { hash: Binary.createFromBase64('sHuAxj9o8MbGe4iRz0Pv1PSi+UY=', 0), keyId: Long('7553982574624768005') } }, operationTime: Timestamp({ t: 1759342255, i: 1 }) }
db.embedded_movies.explain("executionStats").aggregate([ { "$vectorSearch": { "index": "vector_index", "path": "plot_embedding_voyage_3_large", "queryVector": QUERY_EMBEDDING, "numCandidates": 150, "limit": 10, "explainOptions": { "traceDocumentIds": [ ObjectId('573a13d8f29313caabda6557'), ObjectId('573a1398f29313caabce98d9'), ObjectId('573a1391f29313caabcd8319'), ObjectId('573a1398f29313caabceb500'), ObjectId('573a1397f29313caabce780e') ] } } } ])
{ explainVersion: '1', stages: [ { '$vectorSearch': { index: 'vector_index', path: 'plot_embedding_voyage_3_large', queryVector: 'redacted', numCandidates: 150, limit: 10, explainOptions: { traceDocumentIds: [ ObjectId('573a13d8f29313caabda6557'), ObjectId('573a1398f29313caabce98d9'), ObjectId('573a1391f29313caabcd8319'), ObjectId('573a1398f29313caabceb500'), ObjectId('573a1397f29313caabce780e') ] }, explain: { query: { type: 'WrappedKnnQuery', args: { query: [ { type: 'InstrumentableKnnFloatVectorQuery', args: { field: '$type:knnVector/plot_embedding_voyage_3_large', k: 150 }, stats: { context: { millisElapsed: 0 }, match: { millisElapsed: 0 }, score: { millisElapsed: 0 } } }, { type: 'DocAndScoreQuery', args: {}, stats: { context: { millisElapsed: 0.010987, invocationCounts: { createWeight: Long('1'), createScorer: Long('4') } }, match: { millisElapsed: 0.009977, invocationCounts: { nextDoc: Long('152') } }, score: { millisElapsed: 0.018875, invocationCounts: { score: Long('150'), setMinCompetitiveScore: Long('26') } } } } ] }, stats: { context: { millisElapsed: 7.55246, invocationCounts: { vectorExecution: Long('1'), createWeight: Long('1'), createScorer: Long('4') } }, match: { millisElapsed: 0.009977, invocationCounts: { nextDoc: Long('152') } }, score: { millisElapsed: 0.018875, invocationCounts: { score: Long('150'), setMinCompetitiveScore: Long('26') } } } }, collectors: { allCollectorStats: { millisElapsed: 0.148807, invocationCounts: { collect: Long('150'), competitiveIterator: Long('2'), setScorer: Long('2') } } }, metadata: { mongotVersion: '1.54.0', mongotHostName: '<hostname>.mongodb.net', indexName: 'vector_index', lucene: { totalSegments: 2, totalDocs: 3483 } }, resourceUsage: { majorFaults: Long('0'), minorFaults: Long('0'), userTimeMs: Long('0'), systemTimeMs: Long('0'), maxReportingThreads: 1, numBatches: 1 }, vectorTracing: [ { documentId: ObjectId('573a1391f29313caabcd8319'), visited: false, luceneSegment: '_0' }, { documentId: ObjectId('573a1397f29313caabce780e'), visited: true, vectorSearchScore: 0.7469133734703064, luceneSegment: '_0' }, { documentId: ObjectId('573a1398f29313caabce98d9'), visited: false, luceneSegment: '_0' }, { documentId: ObjectId('573a1398f29313caabceb500'), visited: true, vectorSearchScore: 0.7521393895149231, luceneSegment: '_0' }, { documentId: ObjectId('573a13d8f29313caabda6557'), visited: true, vectorSearchScore: 0.7710106372833252, luceneSegment: '_1' } ], luceneVectorSegmentStats: [ { id: '_1', executionType: 'Approximate', docCount: 1531, approximateStage: { millisElapsed: 2.73042 } }, { id: '_0', executionType: 'Approximate', docCount: 1952, approximateStage: { millisElapsed: 4.136979 } } ] } }, nReturned: Long('10'), executionTimeMillisEstimate: Long('21') }, { '$_internalSearchIdLookup': { limit: Long('10'), subPipeline: [ { '$match': { _id: { '$eq': '_id placeholder' } } } ], totalDocsExamined: Long('10'), totalKeysExamined: Long('10'), numDocsFilteredByIdLookup: Long('0') }, nReturned: Long('10'), executionTimeMillisEstimate: Long('22') } ], queryShapeHash: '2E39BED257F2B59D3F8652E1A81A18B1140602C4E253DED9FE208D584EA00083', serverInfo: { host: '<hostname>.mongodb.net', port: 27017, version: '8.2.1-rc1', gitVersion: '3312bdcf28aa65f5930005e21c2cb130f648b8c3' }, serverParameters: { internalQueryFacetBufferSizeBytes: 104857600, internalQueryFacetMaxOutputDocSizeBytes: 104857600, internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600, internalDocumentSourceGroupMaxMemoryBytes: 104857600, internalQueryMaxBlockingSortMemoryUsageBytes: 104857600, internalQueryProhibitBlockingMergeOnMongoS: 0, internalQueryMaxAddToSetBytes: 104857600, internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600, internalQueryFrameworkControl: 'trySbeRestricted', internalQueryPlannerIgnoreIndexWithCollationForRegex: 1 }, command: { aggregate: 'embedded_movies', pipeline: [ { '$vectorSearch': { index: 'vector_index', path: 'plot_embedding_voyage_3_large', queryVector: [ -0.034731735, 0.008558298, -0.0153717, -0.029912498, 0.011549547, ..., -0.006688767, 0.047527634, 0.040714234 ], numCandidates: 150, limit: 10, explainOptions: { traceDocumentIds: [ ObjectId('573a13d8f29313caabda6557'), ObjectId('573a1398f29313caabce98d9'), ObjectId('573a1391f29313caabcd8319'), ObjectId('573a1398f29313caabceb500'), ObjectId('573a1397f29313caabce780e') ] } } } ], cursor: {}, '$db': 'sample_mflix' }, ok: 1, '$clusterTime': { clusterTime: Timestamp({ t: 1759343038, i: 1 }), signature: { hash: Binary.createFromBase64('E3FSIwLHavtFVMsmuqJM5reQc4I=', 0), keyId: Long('7553982574624768005') } }, operationTime: Timestamp({ t: 1759343038, i: 1 }) }