cockroachdb / cockroachdb/cockroach

Got "Drop unused index" recommendation on sequence

Open
#119,624 3 comments 0 reactions 0 assignees View on GitHub
A-observability-inf C-bug O-community T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Describe the problem**

I got an index recommendation "Drop unused index". Reason: This index has not been used and can be removed for better write performance.

But, that is not an index of a table, but a sequence.

CC thinks the index was created like this:
`CREATE INDEX "primary" ON defaultdb.public.nextid USING btree (value ASC)`

But the actual creation statement was:

`CREATE SEQUENCE nextid start with 1001 INCREMENT BY 7;`

**To Reproduce**

A sequence was created as written above.

**Expected behavior**

Not to recommend index deletion on non-existent indicies

**Additional data / screenshots**

![Screenshot from 2024-02-25 16-03-55](https://github.com/cockroachdb/cockroach/assets/4962619/fc8b42ca-2fe2-4334-90a7-a97dbd15f3d1)

**Environment:**

Container in docker swarm
```
# cockroach version
Build Tag: v23.2.1
Build Time: 2024/02/15 22:46:26
Distribution: CCL
Platform: linux amd64 (x86_64-pc-linux-gnu)
Go Version: go1.21.5 X:nocoverageredesign
C Compiler: gcc 6.5.0
Build Commit ID: 898cd6a363fd47bb92a03bac216f9bed0f64bc08
Build Type: release
Enabled Assertions: false
```
**Additional context**
No impact

Jira issue: CRDB-36244

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.