| Previous | Next |
| DB_E_NOCOMMAND | DB_E_BADBOOKMARK |
DB_E_COSTLIMIT
Meaning
Windows documents DB_E_COSTLIMIT as “Query plan within the cost limit cannot be found”. Here, the provider cannot find an execution plan that satisfies the cost limits accepted for the command.
Relevant OLE DB contract
This result must be interpreted against this contract: an OLE DB command moves through explicit states: command definition, properties and parameters are established before optional preparation and execution; dialect, query-tree and optimizer contracts are provider-specific and should be inferred only from reported capabilities.
Diagnostic sequence
- Capture this result immediately at the native OLE DB return and obtain the current OLE DB error object before another COM call replaces thread error information.
- Identify the exact stage: the provider cannot find an execution plan that satisfies the cost limits accepted for the command.
Specific conditions that produce it
- Cause 1: the memory, time or resource ceiling is lower than every viable plan.
- Cause 2: statistics or indexes make all candidate plans too expensive.
- Cause 3: combined cost goals constrain the optimizer beyond provider capability.
Evidence to collect before changing the system
When it involves command text, parameter values, object names and query-plan details, record types, lengths, hashes or redacted identifiers instead of secrets or full business data.
- Evidence 1: the accepted cost-limit values and optimization goals.
- Evidence 2: the command shape, parameter metadata and provider statistics version.
- Evidence 3: provider error records or plan diagnostics explaining the limiting resource.
Corrective actions
- Action 1: relax the specific limit supported by evidence.
- Action 2: improve indexes, statistics or command predicates to reduce plan cost.
- Action 3: avoid silently removing limits that enforce an operational safety boundary.
Retry and recovery policy
Retry rule: retry only after the plan inputs or accepted limits change.
Difference from related HRESULT values
DB_E_ABORTLIMITREACHED reports execution stopped after a resource limit was reached, while DB_E_COSTLIMIT reports failure to find a plan within the limit before results are produced.
Practical incident
A reporting query receives a strict row-processing limit after a table grows and no plan fits; adding a selective index allows execution without discarding the guardrail and clears it.
Official Microsoft references
Looking for a different code? Search another status or error code.
