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}/execute/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.

Profile a run that already happened

explain estimates a plan without running it. To see what an execution actually did, ask for the profile. Set "explain": true in an execute body and the response carries explain_plan alongside the documents: per-stage timings with input and output counts, MVS execution stats, and the optimizer summary for that run.
Read the same profile back later by execution id, without re-running anything:
The profile response is untyped in the OpenAPI spec, so a generated client gives you an open dict rather than named fields. Read keys defensively.It reads the query_profile persisted on the execution record, so an execution run without explain has no profile to return. Ask for explain: true at execute time if you intend to profile the run later.

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.