Are the indexes in CRDB Clustered or Nonclustered?

Q1. Are the indexes in CRDB Clustered or Non-clustered?

Q2. Is it possible to change the structure of an index from one to another?

Q3. Which one will work better for tables with million rows in CRDB?

Q1. Are the indexes in CRDB Clustered or Non-clustered?

The primary key is clustered (to some degree, our on-disk storage is a log-structured merge tree), other indexes aren’t.

Q2. Is it possible to change the structure of an index from one to another?

No.

Q3. Which one will work better for tables with million rows in CRDB?

Well the question is moot, I believe, since you don’t have a choice. The choice you do have, to some extent, is the index you use for your reads. If you’re doing a lot of large scans, you want to use an index that contains all the columns that the query asks for (so that the fact that it’s not clustered becomes irrelevant). See the STORING keyword: https://www.cockroachlabs.com/docs/stable/indexes.html

Hope this helps.

1 Like