If I check SHOW ANALYZE STATUS; I see a lot of failed queries with exception:
[parser:1064]You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use run multiple statements internally is not supported"
I stopped auto analyze, and tried to run analyze manually with query:
analyze table test_table; and got same error in my MySQL client:
SQL Error [1064] [42000]: You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use run multiple statements internally is not supported
What I’ve noticed that all failed tables are present in TiFlash.
No upgrades, started from v6.5.1. Deployed in k8s, using tidb operator. Attaching analyze status output. _SHOW_ANALYZE_STATUS__202304131332.csv (1.2 KB)
Tidb log:
2023-04-13 12:51:08 [2023/04/13 11:51:08.861 +00:00] [ERROR] [analyze.go:318] [“save table stats to storage failed”] [conn=7866431751669379465] [error=“[parser:1064]You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use run multiple statements internally is not supported”] [tableID=1251]
To troubleshoot this further one option is to see if SET GLOBAL tidb_multi_statement_mode=ON and a restart of TiDB allows the analyze process to run without issues.
[2023/04/13 18:45:46.637 +00:00] [WARN] [pd.go:152] ["get timestamp too slow"] ["cost time"=118.628969ms]
[2023/04/13 18:45:46.764 +00:00] [WARN] [pd.go:152] ["get timestamp too slow"] ["cost time"=35.760627ms]
[2023/04/13 18:45:46.765 +00:00] [WARN] [pd.go:152] ["get timestamp too slow"] ["cost time"=31.645138ms]
[2023/04/13 18:45:47.415 +00:00] [ERROR] [analyze.go:318] ["save table stats to storage failed"] [conn=5369196753406920077] [error="[parser:1064]You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use run multiple statements internally is not supported"] [tableID=1267]
[2023/04/13 18:45:47.429 +00:00] [WARN] [session.go:2220] ["run statement failed"] [conn=5369196753406920077] [schemaVersion=1265] [error="[parser:1064]You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use run multiple statements internally is not supported"] [session="{\n \"currDBName\": \"masked-name\",\n \"id\": 5369196753406920077,\n \"status\": 514,\n \"strictMode\": true,\n \"user\": {\n \"Username\": \"root\",\n \"Hostname\": \"10.100.0.13\",\n \"CurrentUser\": false,\n \"AuthUsername\": \"root\",\n \"AuthHostname\": \"%\"\n }\n}"]
[2023/04/13 18:48:35.985 +00:00] [WARN] [pd.go:152] ["get timestamp too slow"] ["cost time"=30.858497ms]
[2023/04/13 18:57:35.911 +00:00] [WARN] [pd.go:152] ["get timestamp too slow"] ["cost time"=103.274251ms]
"[parser:1064]You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 67 near \"yze table active\" "
But I tried to run analyze table active; today also, no such messages from today.
2023-04-15 11:15:21
[2023/04/15 10:15:21.522 +00:00] [ERROR] [update.go:1290] ["[stats] auto analyze failed"] [sql="analyze table `masked-name`.`source_table`"] [cost_time=4h52m22.130447809s] [error="runtime error: slice bounds out of range [-1:]"]Show context
2023-04-15 11:15:21
[2023/04/15 10:15:21.511 +00:00] [ERROR] [analyze.go:308] ["analyze failed"] [error="runtime error: slice bounds out of range [-1:]"]
and this one new:
2023-04-15 11:35:03
[2023/04/15 10:35:03.180 +00:00] [ERROR] [handle.go:623] ["[stats] error occurred when read table stats"] [table=logs] [error="proto: CMSketch: wiretype end group for non-group"]
For the message about the logs table, could you check what’s in the stats tables?
-- Find the TableID for the logs table:
SELECT TIDB_TABLE_ID FROM information_schema.TABLES WHERE TABLE_NAME='logs';
SELECT * FROM mysql.stats_meta WHERE table_id=...;
SELECT * FROM mysql.stats_histograms WHERE table_id=...;
SELECT * FROM mysql.stats_extended WHERE table_id=...;
Uploading a full dump of these tables would also work.
If there is anything special it is probably in the cm_sketch column of the mysql.stats_histograms table.
For the other message: The “Show context”, is that in the log file or is that something from the log viewer that can reveal more details? If so, could you post the details/context?