The system variable setting did not take effect when queried with show variables like

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 系统变量设置后用show variables like 查询没有生效

| username: TiDBer_NxOGHZx6

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version]
[Reproduction Path] What operations were performed when the issue occurred
[Encountered Issue: Issue Phenomenon and Impact]
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachments: Screenshots/Logs/Monitoring]

| username: Jasper | Original post link

You need to exit and reconnect to see it.

| username: zhanggame1 | Original post link

After modifying global, it does not take effect for already connected sessions; the sessions need to reconnect after the parameter modification.

| username: 像风一样的男子 | Original post link

Exit and reconnect, then query again. The global setting does not take effect for the current session.

| username: wangccsy | Original post link

Global is not visible to the current session.

| username: andone | Original post link

Switch to another session window, global is not visible to the current session. You can use the set session syntax to take effect for the current session.

| username: Kongdom | Original post link

This is as expected. It is important to note the scope of system variables; global variables will not affect the current session.

The behavior of TiDB system variables is similar to MySQL, where the scope of variables can be either session-level (Session Scope) or global-level (Global Scope). Specifically:

  • Changes to SESSION scope variables only affect the current session after being set.
  • Changes to GLOBAL scope variables take effect immediately. If the variable also has a SESSION scope, all connected sessions (including the current session) will continue to use the current SESSION variable value.
| username: 路在何chu | Original post link

Exit and re-enter

| username: ShawnYan | Original post link



in the client is equivalent to reconnecting.

| username: TIDB-Learner | Original post link

The difference between global and session scope

| username: dba远航 | Original post link

Global variables need to be reconnected to take effect.

| username: 烂番薯0 | Original post link

Need to switch to another terminal?

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.