Re: Window function optimisation, allow pushdowns of items matching PARTITION BY clauses - Mailing list pgsql-hackers

From David Rowley
Subject Re: Window function optimisation, allow pushdowns of items matching PARTITION BY clauses
Date
Msg-id CAApHDvpB-BFSfFoMDuM-EEUYzByDRH0mCma+m33p+SxuX2MxrQ@mail.gmail.com
Whole thread Raw
In response to Re: Window function optimisation, allow pushdowns of items matching PARTITION BY clauses  (Thomas Mayer <thomas.mayer@student.kit.edu>)
List pgsql-hackers
On Sun, May 25, 2014 at 2:10 PM, Thomas Mayer <thomas.mayer@student.kit.edu> wrote:
Hello David,

sorry for the late response. I will try out your changes from the view of a user in mid-June. However, I can't do a trustworthy code review as I'm not an experienced postgre-hacker (yet).


Thanks, that sort of review will be a great start. 

I've attached an updated patch as it seems there's been a change that removes redundant sorts which was breaking one of the regression tests in v0.2 of the patch.

+EXPLAIN (COSTS OFF)
+SELECT depname,depsalary FROM (SELECT depname,
+                      sum(salary) OVER (PARTITION BY depname) depsalary,
+                      rank() OVER (ORDER BY enroll_date) emprank
+  FROM empsalary) emp
+WHERE depname = 'sales';

This used to produced a plan which included a sort by enroll_date, but this is no longer the case. I've updated the expected results to remove the extra sort from the explain output

Regards

David Rowley
Attachment

pgsql-hackers by date:

Previous
From: Vik Fearing
Date:
Subject: Re: UPDATE SET (a,b,c) = (SELECT ...) versus rules
Next
From: Michael Paquier
Date:
Subject: Re: IMPORT FOREIGN SCHEMA statement