Skip to content

mysql.analyze_jobs missed indexes #57996

@winoros

Description

@winoros

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

Metadata

Metadata

Assignees

Labels

affects-8.1This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.sig/plannerSIG: Plannertype/enhancementThe issue or PR belongs to an enhancement.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions