We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please answer these questions before submitting your issue. Thanks!
Originally encountered by an user https://asktug.com/t/topic/994126 A minimal reproduce can be:
CREATE TABLE `t2` (`col` decimal(20,4) DEFAULT NULL); INSERT INTO `t2` VALUES (round(rand() * 0.49 + 0.0123, 4)); .... (repeat several times) INSERT INTO `t2` SELECT * FROM `t2`; .... (repeat several times to construct enough data) CREATE TABLE `t1` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `c1` decimal(20,2) DEFAULT NULL, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */ ) INSERT INTO t1 (c1) SELECT * FROM t2;
The last query finish in maybe 5~10s
It takes nearly 8min to run the query!
mysql> insert into t1 (c1) select * from t2; Query OK, 491520 rows affected, 65535 warnings (7 min 53.87 sec) Records: 491520 Duplicates: 0 Warnings: 65535
nightly
mysql> select tidb_version(); +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | tidb_version() | +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Release Version: v6.5.0-alpha Edition: Community Git Commit Hash: dc6d9a01112a54af1ac7d0200521ea20b6d09b30 Git Branch: heads/refs/tags/v6.5.0-alpha UTC Build Time: 2022-12-06 14:32:10 GoVersion: go1.19.3 Race Enabled: false TiKV Min Version: 6.2.0-alpha Check Table Before Drop: false Store: tikv | +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
2 necessary conditions to trigger this:
The root cause is that GetWarnings() use a copy on read which is too inefficient!
tidb/sessionctx/stmtctx/stmtctx.go
Lines 730 to 735 in 26bbb71
sessionctx/stmtctx: do not use copy-on-read for GetWarnings function (#…
96eb4ba
…39742) close #39702
tiancaiamao
Successfully merging a pull request may close this issue.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
Originally encountered by an user https://asktug.com/t/topic/994126
A minimal reproduce can be:
2. What did you expect to see? (Required)
The last query finish in maybe 5~10s
3. What did you see instead (Required)
It takes nearly 8min to run the query!
4. What is your TiDB version? (Required)
nightly
The text was updated successfully, but these errors were encountered: