pingcap / pingcap/tidb

bindinfo: add binding-compatible digest field to slow log

Open
#69,139 0 comments 0 reactions 1 assignee Claimed by @qw4990 View on GitHub
component/spm report/customer sig/planner type/feature-request
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Feature Request

**Is your feature request related to a problem? Please describe:**
## Feature Request

The `Digest` field in slow log and the digest used by SQL bindings are computed with different algorithms (`SQLDigest()` vs `NormalizeDigestForBinding` / `NormalizeStmtForBinding`). As a result, the slow log `Digest` cannot be used directly to look up bindings (e.g. `SHOW GLOBAL BINDINGS`, `DROP GLOBAL BINDING FOR SQL DIGEST '...'`, or `mysql.bind_info`).

Please add a new slow log field (e.g. `Binding_sql_digest`) that records the binding-compatible digest when `Plan_from_binding: true`, so users can easily find the corresponding binding from a slow query.

**Describe the feature you'd like:**

Add `bind_sql_digest` in slow log fields.

**Describe alternatives you've considered:**

Can get the `bind_sql_digest` by other ways, like sql function.

**Teachability, Documentation, Adoption, Migration Strategy:**

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.