Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable point get when plan cache is turned on #8095

Closed
eurekaka opened this issue Oct 29, 2018 · 1 comment
Closed

enable point get when plan cache is turned on #8095

eurekaka opened this issue Oct 29, 2018 · 1 comment
Assignees
Labels
sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.

Comments

@eurekaka
Copy link
Contributor

Feature Request

Is your feature request related to a problem? Please describe:

Currently, when plan cache is enabled, point get is disabled for all cases:

func TryFastPlan(ctx sessionctx.Context, node ast.Node) Plan {
    if PreparedPlanCacheEnabled() {
        // Do not support plan cache.
        return nil
    }
    switch x := node.(type) {
    case *ast.SelectStmt:
        fp := tryPointGetPlan(ctx, x)
        if fp != nil {
            if checkFastPlanPrivilege(ctx, fp, mysql.SelectPriv) != nil {
                return nil
            }
            return fp
        }
    case *ast.UpdateStmt:
        return tryUpdatePointPlan(ctx, x)
    case *ast.DeleteStmt:
        return tryDeletePointPlan(ctx, x)
    }
    return nil
}

However, according to Cacheable, we would not cache plan for DELETE/UPDATE at all, so we can enable point get for UPDATE/DELETE at least.

Describe the feature you'd like:

Try point get for DELETE/UPDATE when plan cache is enabled for better performance.

Describe alternatives you've considered:

Remove the PreparedPlanCacheEnabled() check at all for TryFastPlan. Will check whether it is safe later.

Teachability, Documentation, Adoption, Migration Strategy:

N/A

@eurekaka eurekaka added type/enhancement The issue or PR belongs to an enhancement. sig/planner SIG: Planner labels Oct 29, 2018
@eurekaka eurekaka self-assigned this Oct 30, 2018
@eurekaka
Copy link
Contributor Author

After enhancing rebuildRange, point get for select is cacheable now, so we can just remove PreparedPlanCacheEnabled() check for TryFastPlan in total.

@eurekaka eurekaka changed the title enable point get for UPDATE/DELETE when plan cache is turned on enable point get when plan cache is turned on Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

1 participant