Re: Patch to add functionality to specify ORDER BY in CREATE FUNCTION for SRFs

From: Atri Sharma <atri(dot)jiit(at)gmail(dot)com>
To: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch to add functionality to specify ORDER BY in CREATE FUNCTION for SRFs
Date: 2015-01-06 07:23:59
Message-ID: CAOeZVidy-xPc=TQAownb7qci_EUu8S-SLCiPppPDDWZdOqTwEg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 6, 2015 at 12:47 PM, Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
wrote:

>
>
> On Tue, Jan 6, 2015 at 12:38 PM, Atri Sharma <atri(dot)jiit(at)gmail(dot)com> wrote:
>
>>
>>
> May be what Amit has in mind is that the planner can choose the most
> optimal sorting algorithm using the hint that the dataset is probably
> already sorted. Actually why not just do that? Though AFAIK its against
> our stated policy of not adding any planner hints.
>
>
>
I am not sure I totally understand your point. If the dataset is known to
have exact order configuration as requested, why would we need the sort at
all?

I would rather not mess around with the sort algorithm choosing mechanism
anyways. IIUC, the standard way to hint about any existing order is to make
a path and populate its pathkeys with the corresponding existing order
pathkeys (ORDINALITY is the best example here that I can quote).

This is what the patch does. It does not in anyways force the planner or
give it any planner hints, just an optional Path to evalutate. The Path has
pathkeys specified in ORDER BY clause given at time of creation.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Atri Sharma 2015-01-06 07:26:45 Re: Patch to add functionality to specify ORDER BY in CREATE FUNCTION for SRFs
Previous Message Pavan Deolasee 2015-01-06 07:17:54 Re: Patch to add functionality to specify ORDER BY in CREATE FUNCTION for SRFs