user1008537
user1008537

Reputation:

How is RedShift's sortkey different from Clustered Index?

RedShift has a tool called the sortkey, a column which you can specify. This will ensure that the data remains in this sorted order.

How is this any different from a clustered index? This does the same thing.

Upvotes: 0

Views: 2590

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269460

Amazon Redshift does not support indexes. So, calling it an index would be misleading.

Rather, data is physically stored in the order requested. This has the benefit of enabling zone maps, which identify the range of data stored in a given block. For example, if data is sorted by date, each zone map would identify the earliest and latest dates stored in that zone. This helps Redshift ignore blocks that do not contain relevant data.

SORTKEYs can also include multiple columns and even interleaved sorts -- a method of combining two different sort orders while maintaining efficiency.

Upvotes: 3

Related Questions