Skip to main content
Mixpeek optimizes every retriever before it runs — reordering, fusing, and pushing work down into the vector store — then lets you inspect exactly what it did with the explain endpoint. You write the pipeline you find readable; the optimizer makes it fast.

Automatic optimizations

When you execute a retriever, the planner rewrites your stage list before execution. These transformations are automatic — you don’t configure them:
Because the optimizer pushes filters down for you, write filters wherever they read most clearly — you don’t need to hand-order stages for performance. Use explain to confirm what was pushed.
The retriever is also fetched and optimized once per request, then reused across a batch — so POST /v1/retrievers/{id}/execute/batch amortizes planning across all queries.

Inspect the plan with explain

POST /v1/retrievers/{retriever_id}/explain returns the optimized execution plan without running the query — per-stage cost and latency estimates, bottlenecks, and exactly which optimizations were applied. Pass hypothetical inputs to see how the plan changes with different parameters.
Example response
estimated_cost_credits and total_credits are legacy fields expressed in the internal ledger unit (1 credit = $0.001). Customer-facing pricing is in dollars — see Billing.

How to read it

The execution_plan reflects the optimized pipeline, not your original stage list. Compare optimization_details.original_stage_count vs optimized_stage_count to see how much the planner collapsed.

Execution-plan variant

POST /v1/retrievers/{retriever_id}/execute/explain returns the same plan in a MongoDB-explain-style shape if you prefer that format. Both are read-only and never execute the query.

Typical workflow

1

Explain before you ship

Run explain with representative inputs to see estimated cost, bottlenecks, and applied optimizations.
2

Act on bottlenecks & suggestions

Reduce top_k on high-cost searches, add a selective attribute_filter (the optimizer pushes it down), or drop low-selectivity stages.
3

Verify in production

Use retriever analytics to confirm real latency and cache-hit rates match the estimate.