Yuri Levinsky
Yuri Levinsky

Reputation: 1595

Amazon Redshift‎ search with SQL "like" operator on sort key.

I am wondering if it makes a sense to put into sort key column the used for searches with like SQL operator: '%something%'.

Upvotes: 0

Views: 458

Answers (1)

AlexYes
AlexYes

Reputation: 4208

It does not because even with the sort key set it has to scan all rows to find something in the middle. The only case where sort key helps is the statement with wildcard at the end: `like 'something%', this way the engine will look only at the blocks where values start with 's' or something like that. Also it has to be the first column of the sortkey.

Upvotes: 1

Related Questions