There are many sets in TiDB QPS monitoring

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

Original topic: tidb qps监控中set比较多

| username: 大鱼海棠

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version] v5.3.3
There are a lot of sets in the tidb qps monitoring metrics. What is the reason and how can it be optimized?
[Reproduction Path] What operations were performed to encounter the issue
[Encountered Issue: Problem Phenomenon and Impact]
[Resource Configuration]
[Attachments: Screenshots/Logs/Monitoring]

| username: 人如其名 | Original post link

  1. In the case of short connections, session-level variables are set.
  2. In the case of long connections, the program sets session-level variables each time a statement is executed or a transaction is started.
    Both scenarios are likely to increase the number of sets, such as frequently using “set names=xxx” in MySQL. To optimize this, you need to check where the session-level variables are set in the program.
| username: Raymond | Original post link

Some application’s connection pool frameworks will execute set autocommit = 1.

| username: tomsence | Original post link

If the increase happened recently, check the recent production record changes. If it has been persistent, it is likely caused by newly deployed applications, and you need to check if the data source proxy has been changed or parameters have been adjusted. If it is intermittent, it might be due to scheduled scripts or programs that adjust session-level variables with set commands.

| username: system | Original post link

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