Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: 帮忙解释一下聚簇索引的作用
To improve efficiency, please provide the following information. Clear problem descriptions can be resolved faster:
【TiDB Usage Environment】Production
【TiDB Version】6.0
【Encountered Problem】
【Reproduction Path】What operations were performed to encounter the problem
【Problem Phenomenon and Impact】
CREATE TABLE t (a BIGINT, b VARCHAR(255), PRIMARY KEY(a, b) CLUSTERED);
I want to ask, after creating a clustered index, will all queries involving ‘b’ be very fast?
【Attachments】
Inserting data will reduce one network write for index data.
Equality condition queries involving only the primary key will reduce one network read.
Range condition queries involving only the primary key will reduce multiple network reads.
Equality or range condition queries involving only the prefix of the primary key will reduce multiple network reads.
CREATE TABLE t (a BIGINT, b VARCHAR(255), c VARCHAR(255), PRIMARY KEY(a, b, c) CLUSTERED); Can I also put multiple VARCHAR fields in it?
Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.