Unify the SQL digest for the `tidb_runaway_queries` and `runaway_watches` tables

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

Original topic: 统一tidb_runaway_queriesrunaway_watches两个表对SQL的digest

| username: dba-kit

As shown in the figure below, mysql.tidb_runaway_queries and information_schema.runaway_watches use two different digests for SQL, making it impossible to intuitively determine the correspondence between the two. (Judging by time can only be indirect and is too inaccurate. It would be best if the two were unified to facilitate join queries.)

A simple business scenario: when a certain business goes online and multiple slow queries appear, theoretically, both runaway_watches and tidb_runaway_queries will have many entries. At this time, by adding an index, without needing to modify the business SQL, a certain SQL has already been optimized. When you want to delete data from runaway_watches, you will find that you don’t know which record to delete at all.

| username: ShawnYan | Original post link

@dba-kit May I ask which client you are using? The table name even includes an underscore?

| username: dba-kit | Original post link

Oh, I’m using iTerm 2. The underline appears because the mouse happens to be over the table name when taking the screenshot. Normally, there wouldn’t be any prompt. :rofl:

| username: Roger_Song | Original post link

The “watch” in information_schema.runaway_watches is similar, so the text corresponds to sql_digest. We will add the sql_digest column to mysql.tidb_runaway_queries in future versions to accommodate this scenario. Thank you for the suggestion.

| username: TIDB-Learner | Original post link

:+1: :+1: :+1: :+1: :+1: :+1: :+1:

| username: dba-kit | Original post link

Can 7.5.1 make it in time? :monkey:
We are currently testing TiDB 7.5, focusing on its resource management capabilities. We are planning to use version 7.5.1, which is expected to be released in February or March. Hopefully, it will be ready in time.

| username: Roger_Song | Original post link

The addition of new columns will be considered as breaking compatibility, and unless there are special circumstances, it will not be allowed in the released versions. This table only retains data for 7 days, and data older than 7 days will be automatically deleted. If it cannot be cleaned up in association, it can temporarily be left for the system to handle automatically.

| username: dba-kit | Original post link

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