Redshift Configuration SORTKEY AUTO?

Hi there! I was reading this page on Redshift configs. It says that…

sort accepts a list of sort keys, for example: ['timestamp', 'userid']. dbt will build the sort key in the same order the fields are supplied.

I tested it and it doesn’t seem that sort can accept auto. Setting sort key to auto is the default recommendation from AWS.

Can someone confirm that I’m not missing anything? That I’m correct that we can’t set sort to auto in dbt?

I would look into the code of dbt-labs/dbt-redshift: dbt-redshift contains all of the code enabling dbt to work with Amazon Redshift (github.com)

My understanding is that SORTKEY AUTO only works for long-lived tables, so that their optimizer has data on how the tables are being queried. Except for materialized=incremental models, tables are dropped by dbt with every run, which makes AUTO ineffective.

2 Likes

That’s a good callout, Ted, thank you!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.