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

Updated sql-plan-management.md #6184

Merged
merged 4 commits into from
Aug 20, 2021
Merged
Changes from 1 commit
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
Next Next commit
Update sql-plan-management.md
  • Loading branch information
hfxsd committed Aug 17, 2021
commit a7bc427568a31bd19abbcb9a49846b93e5d81e22
37 changes: 37 additions & 0 deletions sql-plan-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,3 +287,40 @@ Because the baseline evolution automatically creates a new binding, when the que
| `max_execution_time` | The longest duration for a query. |

+ `read_from_storage` is a special hint in that it specifies whether to read data from TiKV or from TiFlash when reading tables. Because TiDB provides isolation reads, when the isolation condition changes, this hint has a great influence on the evolved execution plan. Therefore, when this hint exists in the initially created binding, TiDB ignores all its evolved bindings.

## Upgrade Checklist
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

SQL Plan Management (SPM) may fail in upgrade due to compatibility issues. You need to check the environment before upgrade to make sure it succeeds.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

* When you upgrade from a version earlier than v5.2.0 (that is, v4.0, v5.0, and v5.1) to the current version, make sure `tidb_evolve_plan_baselines` is disabled. If not, you must disable it before upgrade. Perform the following steps.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* When you upgrade from a version earlier than v5.2.0 (that is, v4.0, v5.0, and v5.1) to the current version, make sure `tidb_evolve_plan_baselines` is disabled. If not, you must disable it before upgrade. Perform the following steps.
* When you upgrade from a version earlier than v5.2.0 (that is, v4.0, v5.0, and v5.1) to the current version, make sure that the system variable `tidb_evolve_plan_baselines` is disabled before the upgrade. To disable this variable, perform the following steps.

{{< copyable "sql" >}}

```sql
-- Check whether `tidb_evolve_plan_baselines` is disabled in the earlier version.

select @@global.tidb_evolve_plan_baselines;

-- If `tidb_evolve_plan_baselines` is still enabled, disable it.

set global tidb_evolve_plan_baselines = off;
```

* Before you upgrade from v4.0 to the current version, you must check whether the grammar of all the SQL statements corresponding to available SQL bindings is correct in the new version. If any grammatical errors, delete the corresponding SQL bindings.
Perform the following steps.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Before you upgrade from v4.0 to the current version, you must check whether the grammar of all the SQL statements corresponding to available SQL bindings is correct in the new version. If any grammatical errors, delete the corresponding SQL bindings.
Perform the following steps.
* Before you upgrade from v4.0 to the current version, you must check whether the grammar of all the SQL statements corresponding to available SQL bindings is correct in the new version. If any grammatical errors, delete the corresponding SQL bindings. Perform the following steps.


{{< copyable "sql" >}}

```sql
-- Check the SQL statements corresponding to available SQL bindings in the version to be upgraded.

select bind_sql from mysql.bind_info where source != 'builtin' and status = 'using';
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

-- Verify the result from the above SQL query in the test environment of the new version.

bind_sql_0;
bind_sql_1;
...

-- In the case of a syntax error (ERROR 1064 (42000): You have an error in your SQL syntax), delete the corresponding binding.
-- For any other errors (for example, tables are not found), it means the syntax is compatible. No intervention is needed.
```