Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redshift PostgresQL syntax: is named window clause valid?

I suspect that Redshift does not support named windows, as Postgres has since at least version 8.4:

select stuff
       , stuff_category
       , sum(dollars) over W

from   table

window W as (partition by stuff_category)

However I would like to know definitively and I can't find a reference, or any post that says 'no we didn't implement this for very good reason yada yada.'

The AWS Redshift SQL Reference makes no mention of the 'window as' syntax - I suppose I should take this as an answer.

Here's an SO answer relating to Postgres named windows

Here's the Postgres 8.4 documentation on WINDOW AS () syntax

like image 464
Merlin Avatar asked Apr 06 '17 21:04

Merlin


People also ask

Does Redshift support window functions?

Amazon Redshift supports two types of window functions: aggregate and ranking. These are the supported aggregate functions: AVG. COUNT.

What is window function in PostgreSQL?

A window function performs a calculation across a set of table rows that are somehow related to the current row. This is comparable to the type of calculation that can be done with an aggregate function.

What SQL syntax does Redshift use?

The SQL language consists of commands that you use to create and manipulate database objects, run queries, load tables, and modify the data in tables. Amazon Redshift is based on PostgreSQL.

How do I transfer data from Postgres to Redshift?

Manually move data from Postgres to Redshift using code. You will need to create pipelines that extract data from its source (Postgres), transform the data into the correct format, and load it to the final destination (Redshift) via a process called extract, transform and load (ETL).


1 Answers

Redshift does not support named windows.

As I have learned over time, the RS documentation will specify what is supported and if not mentioned its safe to assume it is not supported. There are no easter eggs or undocumented features to try and find, Legend of Zelda style.

AWS Window Function Documentation

AWS Docs Redshift and Postgres Comparison This does not mention window functions, but is a good resource for this type of question.

like image 154
Merlin Avatar answered Oct 05 '22 02:10

Merlin