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

include the description of critical issue 51407 in doc #16832

Merged
merged 6 commits into from
Mar 29, 2024
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions sql-prepared-plan-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ aliases: ['/tidb/dev/sql-prepare-plan-cache']

# SQL Prepared Execution Plan Cache

> **Warning:**
>
> If a cached `UPDATE` or `DELETE` statement encounters a DDL operation that modifies the relevant schema during execution, it might cause data inconsistency between tables and indexes. For more information, see [Issue #51407](https://github.com/pingcap/tidb/issues/51407). Keep updated to the progress of [the latest LTS version](https://docs.pingcap.com/tidb/stable) to resolve this issue. The following are possible workarounds before upgrading:
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
>
> - Before submitting DDL, temporarily [disable the execution plan cache for Prepare statements](/system-variables.md#tidb_enable_prepared_plan_cache-new-in-v610), and restore the setting of plan cache after the DDL execution.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
> - Avoid executing DDL during business peak hours. After executing DDL, immediately run [`ADMIN CHECK TABLE`](/sql-statements/sql-statement-admin-check-table-index.md) to verify the consistency between tables and indexes. If errors are found, rebuild the relevant indexes.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

TiDB supports execution plan caching for `Prepare` and `Execute` queries. This includes both forms of prepared statements:

- Using the `COM_STMT_PREPARE` and `COM_STMT_EXECUTE` protocol features.
Expand Down
Loading