Get an estimated execution plan for a retriever, similar to MongoDB’s explain command. Shows the OPTIMIZED pipeline after automatic transformations, cost estimates, bottleneck identification, and detailed optimization decisions.
What This Returns:
Important: The execution_plan shows the OPTIMIZED stages (after reordering, merging, and push-downs), not your original user-defined stages. See optimization_details to understand what transformations were applied.
Use Cases:
Example Response:
{
"retriever_id": "ret_abc123",
"execution_plan": [
{"stage_name": "attribute_filter", "estimated_duration_ms": 20, ...},
{"stage_name": "feature_filter", "estimated_duration_ms": 200, ...}
],
"optimization_applied": true,
"optimization_details": {
"original_stage_count": 5,
"optimized_stage_count": 3,
"stage_reduction_pct": 40.0,
"decisions": [
{"rule_type": "push_down_filters", "applied": true, "reason": "..."}
]
}
}
REQUIRED: Bearer token authentication using your API key. Format: 'Bearer sk_xxxxxxxxxxxxx'. You can create API keys in the Mixpeek dashboard under Organization Settings.
REQUIRED: Namespace identifier for scoping this request. All resources (collections, buckets, taxonomies, etc.) are scoped to a namespace. You can provide either the namespace name or namespace ID. Format: ns_xxxxxxxxxxxxx (ID) or a custom name like 'my-namespace'
Retriever ID or name to explain. The explain plan will be generated for the OPTIMIZED version of this retriever.
Optional hypothetical inputs to tailor estimation. Use this to see how the plan changes with different input parameters (e.g., different top_k values, different query types).
Hypothetical inputs used to tailor estimation. These are used to estimate stage behavior and costs. Example: {'query': 'test', 'top_k': 100}
Execution plan with cost estimates, optimization details, and performance insights. Shows the OPTIMIZED pipeline (after automatic transformations). Use optimization_details to understand what changed from your original pipeline.
Explain plan response for a retriever.
Retriever identifier
Retriever name
Estimated cost breakdown (credits/time)
Total stages considered
x >= 0Ordered stage plan
Potential optimizations
Stages expected to dominate cost
Optimizer level applied (e.g., none/mvp/advanced)
Whether automatic pipeline optimizations were applied to this explain plan. The execution_plan shows the OPTIMIZED stages (after transformations), not the original user-defined stages. When true, see optimization_details to understand what changed and why.
Detailed breakdown of optimizations applied to the pipeline. Only present when optimization_applied=true. Contains: - original_stage_count: Your original stage count - optimized_stage_count: Stages after optimization - optimization_time_ms: Time spent on optimization (<100ms) - decisions: Array of optimization decisions with rule_type, applied, reason - stage_reduction_pct: Percentage reduction in stages Each decision shows which rule fired, whether it applied, and the reason. Use this to understand how your pipeline was transformed for optimal performance.
{
"decisions": [
{
"applied": true,
"reason": "Moved attribute_filter before feature_filter",
"rule_type": "push_down_filters",
"stages_after": 5,
"stages_before": 5
},
{
"applied": true,
"reason": "Merged group_by into feature_filter for database-level grouping",
"rule_type": "group_by_push_down",
"stages_after": 3,
"stages_before": 5
}
],
"optimization_time_ms": 8.2,
"optimized_stage_count": 3,
"original_stage_count": 5,
"stage_reduction_pct": 40
}