I am using TiDB to do some testing.
I created a table as below
CREATE TABLE users(
id BIGINT PRIMARY KEY NOT NULL,
updated BIGINT NOT NULL
)
I loaded around 100,000,000 rows into this table with 2 indexes
CREATE INDEX hash_index USING HASH ON users (id);
CREATE INDEX btree_index USING BTREE ON users (updated);
I found query speed became very slow, it would take a few seconds
Query sql is below. I only used the first index.
SELECT * FROM users where id=1999;
I solved this slow issue by deleting the second index updated
I thought second index cause this issue.
I was just wondering how it happened?