pingcap / pingcap/tidb

Add tidb_max_estimated_cost to prevent very expensive queries to start executing

Open
#64,052 0 comments 0 reactions 1 assignee Claimed by @mjonss View on GitHub
type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement

Add a system variable `tidb_max_estimated_cost` in both GLOBAL and SESSION contex, as well as available in SET_VAR() optimizer hint. I would argue for also have it available as direct optimizer hint as well `TIDB_MAX_ESTIMATED_COST()`.

This would allow users to not waste resources on queries that would take too long time to execute. As well as returning an error if the generated plan is expensive, instead of running the expensive plan.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.