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

mysql.analyze_jobs missed indexes #57996

Closed
winoros opened this issue Dec 4, 2024 · 0 comments · Fixed by #58134 · May be fixed by #58608
Closed

mysql.analyze_jobs missed indexes #57996

winoros opened this issue Dec 4, 2024 · 0 comments · Fixed by #58134 · May be fixed by #58608
Assignees
Labels
affects-8.1 This bug affects the 8.1.x(LTS) versions. affects-8.5 This bug affects the 8.5.x(LTS) versions. sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.

Comments

@winoros
Copy link
Member

winoros commented Dec 4, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

https://github.com/winoros/tidb/blob/debugging/pkg/statistics/handle/autoanalyze/priorityqueue/interval.go

Some internal SQLs're running on the table mysql.analyze_jobs.

But, this table only has one index.

CREATE TABLE `analyze_jobs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `table_schema` char(64) NOT NULL DEFAULT '',
  `table_name` char(64) NOT NULL DEFAULT '',
  `partition_name` char(64) NOT NULL DEFAULT '',
  `job_info` text NOT NULL,
  `processed_rows` bigint unsigned NOT NULL DEFAULT '0',
  `start_time` timestamp NULL DEFAULT NULL,
  `end_time` timestamp NULL DEFAULT NULL,
  `state` enum('pending','running','finished','failed') NOT NULL,
  `fail_reason` text DEFAULT NULL,
  `instance` varchar(512) NOT NULL COMMENT 'address of the TiDB instance executing the analyze job',
  `process_id` bigint unsigned DEFAULT NULL COMMENT 'ID of the process executing the analyze job',
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  KEY `update_time` (`update_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=901003903

As a result, we'll see a lot of full scan in a big cluster testing.
Image

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

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

master

@winoros winoros added affects-8.1 This bug affects the 8.1.x(LTS) versions. affects-8.5 This bug affects the 8.5.x(LTS) versions. sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement. labels Dec 4, 2024
@ti-chi-bot ti-chi-bot bot closed this as completed in dde1dcd Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-8.1 This bug affects the 8.1.x(LTS) versions. affects-8.5 This bug affects the 8.5.x(LTS) versions. sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
2 participants