Re: Window function optimisation, allow pushdowns of items matching PARTITION BY clauses

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Thomas Mayer <thomas(dot)mayer(at)student(dot)kit(dot)edu>
Cc: David Rowley <dgrowley(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Window function optimisation, allow pushdowns of items matching PARTITION BY clauses
Date: 2014-06-17 09:27:14
Message-ID: CAApHDvpB-BFSfFoMDuM-EEUYzByDRH0mCma+m33p+SxuX2MxrQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, May 25, 2014 at 2:10 PM, Thomas Mayer <thomas(dot)mayer(at)student(dot)kit(dot)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 Content-Type Size
wfunc_pushdown_partitionby_v0.3.patch application/octet-stream 14.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2014-06-17 09:30:30 Re: IMPORT FOREIGN SCHEMA statement
Previous Message Vik Fearing 2014-06-17 09:22:17 Re: UPDATE SET (a,b,c) = (SELECT ...) versus rules