SHOW [GLOBAL|SESSION] VARIABLES
SHOW [GLOBAL|SESSION] VARIABLES 语句用于显示 GLOBAL 或 SESSION 范围的变量列表。如果未指定范围,则应用默认范围 SESSION。
语法图
ShowVariablesStmt

ShowLikeOrWhere

1. ShowVariablesStmt ::=
2. "SHOW" ("GLOBAL" | "SESSION")? VARIABLES ShowLikeOrWhere?
4. ShowLikeOrWhere ::=
5. "LIKE" SimpleExpr
6. | "WHERE" Expression
示例
查看 TiDB 定义的专用系统变量,关于这些变量的含义参见系统变量和语法。
1. SHOW GLOBAL VARIABLES LIKE 'tidb%';
1. +-------------------------------------+---------------------+
2. | Variable_name | Value |
3. +-------------------------------------+---------------------+
4. | tidb_allow_batch_cop | 0 |
5. | tidb_allow_remove_auto_inc | 0 |
6. | tidb_auto_analyze_end_time | 23:59 +0000 |
7. | tidb_auto_analyze_ratio | 0.5 |
8. | tidb_auto_analyze_start_time | 00:00 +0000 |
9. | tidb_backoff_lock_fast | 100 |
10. | tidb_backoff_weight | 2 |
11. | tidb_batch_commit | 0 |
12. | tidb_batch_delete | 0 |
13. | tidb_build_stats_concurrency | 4 |
14. | tidb_capture_plan_baselines | off |
15. | tidb_check_mb4_value_in_utf8 | 1 |
16. | tidb_checksum_table_concurrency | 4 |
17. | tidb_config | |
18. | tidb_constraint_check_in_place | 0 |
19. | tidb_current_ts | 0 |
20. | tidb_ddl_error_count_limit | 512 |
21. | tidb_ddl_reorg_batch_size | 256 |
22. | tidb_ddl_reorg_priority | PRIORITY_LOW |
23. | tidb_ddl_reorg_worker_cnt | 4 |
24. | tidb_disable_txn_auto_retry | 1 |
25. | tidb_distsql_scan_concurrency | 15 |
26. | tidb_dml_batch_size | 20000 |
27. | tidb_enable_cascades_planner | 0 |
28. | tidb_enable_chunk_rpc | 1 |
29. | tidb_enable_collect_execution_info | 1 |
30. | tidb_enable_index_merge | 0 |
31. | tidb_enable_noop_functions | 0 |
32. | tidb_enable_radix_join | 0 |
33. | tidb_enable_slow_log | 1 |
34. | tidb_enable_stmt_summary | 1 |
35. | tidb_enable_table_partition | on |
36. | tidb_enable_vectorized_expression | 1 |
37. | tidb_enable_window_function | 1 |
38. | tidb_evolve_plan_baselines | off |
39. | tidb_evolve_plan_task_end_time | 23:59 +0000 |
40. | tidb_evolve_plan_task_max_time | 600 |
41. | tidb_evolve_plan_task_start_time | 00:00 +0000 |
42. | tidb_expensive_query_time_threshold | 60 |
43. | tidb_force_priority | NO_PRIORITY |
44. | tidb_general_log | 0 |
45. | tidb_hash_join_concurrency | 5 |
46. | tidb_hashagg_final_concurrency | 4 |
47. | tidb_hashagg_partial_concurrency | 4 |
48. | tidb_index_join_batch_size | 25000 |
49. | tidb_index_lookup_concurrency | 4 |
50. | tidb_index_lookup_join_concurrency | 4 |
51. | tidb_index_lookup_size | 20000 |
52. | tidb_index_serial_scan_concurrency | 1 |
53. | tidb_init_chunk_size | 32 |
54. | tidb_isolation_read_engines | tikv, tiflash, tidb |
55. | tidb_low_resolution_tso | 0 |
56. | tidb_max_chunk_size | 1024 |
57. | tidb_max_delta_schema_count | 1024 |
58. | tidb_mem_quota_hashjoin | 34359738368 |
59. | tidb_mem_quota_indexlookupjoin | 34359738368 |
60. | tidb_mem_quota_indexlookupreader | 34359738368 |
61. | tidb_mem_quota_mergejoin | 34359738368 |
62. | tidb_mem_quota_nestedloopapply | 34359738368 |
63. | tidb_mem_quota_query | 1073741824 |
64. | tidb_mem_quota_sort | 34359738368 |
65. | tidb_mem_quota_topn | 34359738368 |
66. | tidb_metric_query_range_duration | 60 |
67. | tidb_metric_query_step | 60 |
68. | tidb_opt_agg_push_down | 0 |
69. | tidb_opt_concurrency_factor | 3 |
70. | tidb_opt_copcpu_factor | 3 |
71. | tidb_opt_correlation_exp_factor | 1 |
72. | tidb_opt_correlation_threshold | 0.9 |
73. | tidb_opt_cpu_factor | 3 |
74. | tidb_opt_desc_factor | 3 |
75. | tidb_opt_disk_factor | 1.5 |
76. | tidb_opt_distinct_agg_push_down | 0 |
77. | tidb_opt_insubq_to_join_and_agg | 1 |
78. | tidb_opt_join_reorder_threshold | 0 |
79. | tidb_opt_memory_factor | 0.001 |
80. | tidb_opt_network_factor | 1 |
81. | tidb_opt_scan_factor | 1.5 |
82. | tidb_opt_seek_factor | 20 |
83. | tidb_opt_write_row_id | 0 |
84. | tidb_optimizer_selectivity_level | 0 |
85. | tidb_pprof_sql_cpu | 0 |
86. | tidb_projection_concurrency | 4 |
87. | tidb_query_log_max_len | 4096 |
88. | tidb_record_plan_in_slow_log | 1 |
89. | tidb_replica_read | leader |
90. | tidb_retry_limit | 10 |
91. | tidb_row_format_version | 2 |
92. | tidb_scatter_region | 0 |
93. | tidb_skip_isolation_level_check | 0 |
94. | tidb_skip_utf8_check | 0 |
95. | tidb_slow_log_threshold | 300 |
96. | tidb_slow_query_file | tidb-slow.log |
97. | tidb_snapshot | |
98. | tidb_stmt_summary_history_size | 24 |
99. | tidb_stmt_summary_internal_query | 0 |
100. | tidb_stmt_summary_max_sql_length | 4096 |
101. | tidb_stmt_summary_max_stmt_count | 3000 |
102. | tidb_stmt_summary_refresh_interval | 1800 |
103. | tidb_store_limit | 0 |
104. | tidb_txn_mode | |
105. | tidb_use_plan_baselines | on |
106. | tidb_wait_split_region_finish | 1 |
107. | tidb_wait_split_region_timeout | 300 |
108. | tidb_window_concurrency | 4 |
109. +-------------------------------------+---------------------+
110. 108 rows in set (0.01 sec)
1. SHOW GLOBAL VARIABLES LIKE 'time_zone%';
1. +---------------+--------+
2. | Variable_name | Value |
3. +---------------+--------+
4. | time_zone | SYSTEM |
5. +---------------+--------+
6. 1 row in set (0.00 sec)
1. SHOW VARIABLES WHERE Variable_name="tidb_window_concurrency";
1. +-------------------------+-------+
2. | Variable_name | Value |
3. +-------------------------+-------+
4. | tidb_window_concurrency | -1 |
5. +-------------------------+-------+
6. 1 row in set (0.00 sec)
1. SHOW VARIABLES WHERE Value=300;
1. +--------------------------------+-------+
2. | Variable_name | Value |
3. +--------------------------------+-------+
4. | ddl_slow_threshold | 300 |
5. | delayed_insert_timeout | 300 |
6. | innodb_purge_batch_size | 300 |
7. | key_cache_age_threshold | 300 |
8. | slave_checkpoint_period | 300 |
9. | tidb_slow_log_threshold | 300 |
10. | tidb_wait_split_region_timeout | 300 |
11. +--------------------------------+-------+
12. 7 rows in set (0.00 sec)
MySQL 兼容性
SHOW [GLOBAL|SESSION] VARIABLES 语句与 MySQL 完全兼容。如发现任何兼容性差异,请尝试 TiDB 支持资源。
