Navicat queries TiDB data, the query results show a very short duration, but Navicat returns very slowly

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

Original topic: Navicat查询TIDB数据,查询结果返回后显示耗时很短,但是Navciat返回很慢

| username: Johnnes_Xnn

【TiDB Usage Environment】Production Environment
【TiDB Version】7.1.0
【Reproduction Path】Using Navicat for queries
【Encountered Issue: Navicat querying TiDB data, the query result shows a very short duration, but Navicat returns very slowly】
【Issue Screenshot】

| username: Johnnes_Xnn | Original post link

Using HAProxy as a proxy

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

Total SQL execution time = client driver processing time + database SQL execution time + communication time
The displayed query time is the total SQL execution time.

| username: 随缘天空 | Original post link

It should be caused by Navicat itself, but it doesn’t matter. If you use code to execute the query operation, it might not take that long.

| username: Jellybean | Original post link

You can manually access the database without using Navicat to confirm whether it is a problem with Navicat.

| username: tidb狂热爱好者 | Original post link

You must learn how to import using the command line
mysql < 1.sql

| username: wangccsy | Original post link

The displayed time is the SQL execution time, and the time-consuming part is the transfer to the UI and the time taken to display on the UI.

| username: xingzhenxiang | Original post link

Try bypassing HAProxy.
Or try using MySQL directly.
Additionally, Navicat’s licensing is very strict.

| username: Kongdom | Original post link

This is normal. We also noticed this when using Navicat. You just need to pay attention to the time taken for the query results to return.

| username: zhanggame1 | Original post link

It should be an issue with Navicat’s rendering time.

| username: dba远航 | Original post link

Try upgrading the version.

| username: Jjjjayson_zeng | Original post link

I have tested this issue and it has occurred before. The root cause is still machine imbalance, with queries falling onto a specific machine.

| username: Jjjjayson_zeng | Original post link

It has nothing to do with the Navicat tool.

| username: Jjjjayson_zeng | Original post link

For example, if it falls on a certain TiKV, a simple solution is to vertically upgrade the machine, such as upgrading the configuration of a certain machine.

| username: Johnnes_Xnn | Original post link

How did it end up on that machine?

| username: Jjjjayson_zeng | Original post link

Just directly look at the Grafana monitoring to see which machine’s CPU is increasing rapidly.

| username: Jjjjayson_zeng | Original post link

Because the query session on the page and the session on Navicat fall on different TiDB machines, this issue can occur. We’ve encountered this problem many times.

| username: Jjjjayson_zeng | Original post link

Looking at your PD allocation, we randomly allocate anyway, so just upgrade all the configurations and the problem will be solved.