Skip to content
New issue

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

Analyze is too slow when run dml in million tables scenario #57631

Open
lilinghai opened this issue Nov 22, 2024 · 0 comments
Open

Analyze is too slow when run dml in million tables scenario #57631

lilinghai opened this issue Nov 22, 2024 · 0 comments
Assignees
Labels
affects-8.5 This bug affects the 8.5.x(LTS) versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@lilinghai
Copy link
Contributor

lilinghai commented Nov 22, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. about 100k partition tables and each 10k rows
CREATE TABLE `sbtest1` (
  `id` int NOT NULL AUTO_INCREMENT,
  `k` int NOT NULL DEFAULT '0',
  `c` char(120) NOT NULL DEFAULT '',
  `pad` char(60) NOT NULL DEFAULT '',
  `ec1` varchar(40) DEFAULT NULL,
  `ec2` varchar(40) DEFAULT NULL,
  `ec3` varchar(40) DEFAULT NULL,
  `ec4` varchar(40) DEFAULT NULL,
  `ec5` varchar(40) DEFAULT NULL,
  `ec6` varchar(40) DEFAULT NULL,
  `ec7` varchar(40) DEFAULT NULL,
  `ec8` varchar(40) DEFAULT NULL,
  `ec9` varchar(40) DEFAULT NULL,
  `ec10` varchar(40) DEFAULT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  KEY `k_2` (`k`),
  KEY `ek1` (`ec1`(30)),
  KEY `ek2` (`ec2`(30)),
  KEY `ek3` (`ec3`(30)),
  KEY `ek4` (`ec4`(30))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=1087002
PARTITION BY RANGE (`id`)
(PARTITION `p1` VALUES LESS THAN (1001),
 PARTITION `p2` VALUES LESS THAN (2001),
 PARTITION `p3` VALUES LESS THAN (3001),
 PARTITION `p4` VALUES LESS THAN (4001),
 PARTITION `p5` VALUES LESS THAN (5001),
 PARTITION `p6` VALUES LESS THAN (6001),
 PARTITION `p7` VALUES LESS THAN (7001),
 PARTITION `p8` VALUES LESS THAN (8001),
 PARTITION `p9` VALUES LESS THAN (9001),
 PARTITION `p10` VALUES LESS THAN (MAXVALUE))
  1. run dml on some of the tables
  2. execute analyze table
    It takes about 3 seconds if not having dml workload
mysql> analyze table sbtest100.sbtest1;
Query OK, 0 rows affected, 10 warnings (21 min 48.62 sec)

2. What did you expect to see? (Required)

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

master

Release Version: v8.5.0
Edition: Community
Git Commit Hash: eb871f8
Git Branch: heads/refs/tags/v8.5.0
UTC Build Time: 2024-11-22 03:01:24
GoVersion: go1.23.3
Race Enabled: false
Check Table Before Drop: false
Store: tikv

@lilinghai lilinghai added the type/bug The issue is confirmed as a bug. label Nov 22, 2024
@jebter jebter added the affects-8.5 This bug affects the 8.5.x(LTS) versions. label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-8.5 This bug affects the 8.5.x(LTS) versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

3 participants