AcceptsThe names of one or more columns in a derived table
sortkeys enables you to specify one or more columns of a persistent derived table on which to apply a regular sort key. Currently,
sortkeys only works with Redshift databases. You can also create an interleaved sort key by using
indexes instead. You cannot use both at the same time, but at least one is required.
Traditional SQL dialects (such as MySQL and Postgres) should use
sortkeys will not work with these databases.
Generally speaking, a sort key should be applied to date or time columns in the derived table, and possibly to columns that will be used frequently as filters. More information can be found in the Amazon Redshift documentation.
All of these examples assume that you are working with a Redshift database so that you can use the
customer_day_facts persistent native derived table (NDT) that has a sortkey on
date and rebuilds when the datagroup
order_datagroup is triggered:
customer_day_facts derived table that is based on a SQL query and has a sortkey on
customer_day_facts derived table that is based on a SQL query with a sortkey on
sortkeys Only Works with Derived Tables That Are Persisted
Derived tables can be calculated at query time, or they can be made persistent using
sortkeys parameter works only with persistent derived tables.