Indexing

broken image

In contrast, without an index, SQL would have to evaluate every row in the table for values equaling 10. On large tables, this greatly reduces the number of rows SQL has to use, executing queries exponentially faster.įor example, if you index an INT column and then filter it WHERE = 10, SQL can use the index to find values starting at 10 but less than 11.

broken image

When you create an index, CockroachDB 'indexes' the columns you specify, which creates a copy of the columns and then sorts their values (without sorting the values in the table itself).Īfter a column is indexed, SQL can easily filter its values using the index instead of scanning each row one-by-one. Indexes improve your database's performance by helping SQL locate data without having to look through every row of a table.

broken image