[TiDB Usage Environment] Online, Testing, Research
[TiDB Version]
[Encountered Problem]
Cluster Version: 4.0.6
An SQL statement hasn’t been committed. By checking INFORMATION_SCHEMA.CLUSTER_PROCESSLIST, I can find the DIGEST. How can I view the SQL statement corresponding to this DIGEST?
[Reproduction Path] What operations were performed to encounter the problem
[Problem Phenomenon and Impact]
[Attachments]
Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.
I tested version 6.1 on my side and it works. There are no normal entries in cluster_slow_query; queries that execute quickly but are not committed will not be recorded. You can try increasing the parameters above; it is possible that there are too many types of SQL queries, causing some to be removed.
I feel that the information viewed from the cluster_statements_summary (this view currently has a total of only 15 records) is not accurate. I just executed an SQL, and then I couldn’t see it in this view.
I tested it several times, and sometimes it’s accurate, sometimes it’s not. It feels like the content in INFORMATION_SCHEMA.CLUSTER_STATEMENTS_SUMMARY is not updated in a timely or accurate manner.
Retested it again, still having issues, the process is as follows:
tidb_stmt_summary_history_size=24
tidb_stmt_summary_max_sql_length=4096
tidb_stmt_summary_max_stmt_count=200
tidb_stmt_summary_refresh_interval=1800
Issue:
Executing SQL statements like update tabname set name=? where id=? multiple times, when checking the recorded SQL content in the table, only the first executed SQL statement can be seen.
Testing process:
SESSION1:
begin;
update zjp set name=‘DDD’ where id=3;
SESSION2:
Check the DIGEST corresponding to this SQL, and check the SQL text corresponding to that DIGEST
select query_sample_text from information_schema.cluster_statements_summary where digest=‘xxx’;
The text seen is the SQL statement just executed.
SESSION1:
commit; commit the previous modification
update zjp set name=‘BBB’ where id=2;
SESSION2:
select query_sample_text from information_schema.cluster_statements_summary where digest=‘xxx’;
The text seen is still the first executed SQL text, and the second one (update zjp set name='BBB' where id=2;) is not seen.