pingcap / pingcap/tidb

`sys.schema_unused_indexes` doesn't work well

Open
#64,141 4 comments 0 reactions 1 assignee Claimed by @YangKeao View on GitHub
may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 may-affects-8.5 severity/major sig/sql-infra type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

```
CREATE TABLE t (id int primary key, col int unique);
SELECT * FROM sys.schema_unused_indexes;
```

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

1. The rows should include `col`;
2. The rows shouldn't include `primary`;

The first is because of some execution issue in tidb coprocessor (but I'm not sure, the plan looks good).

The second is because the `primary` should be `PRIMARY`. I should modify it in the view definition.

### 3. What did you see instead (Required)

It only has one row: `primary`.

### 4. What is your TiDB version? (Required)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.