Re: Super PathKeys (Allowing sort order through precision loss functions)

2018-11-01 Thread Tomas Vondra
On 11/01/2018 02:40 AM, David Rowley wrote: On 1 November 2018 at 12:24, Andres Freund wrote: FWIW, I kind of wonder if we built proper infrastructure to allow to make such inferrences from function calls, whether it could also be made to support the transformation of LIKEs into indexable <=

Re: Super PathKeys (Allowing sort order through precision loss functions)

2018-10-31 Thread David Rowley
On 1 November 2018 at 12:24, Andres Freund wrote: > FWIW, I kind of wonder if we built proper infrastructure to allow to > make such inferrences from function calls, whether it could also be made > to support the transformation of LIKEs into indexable <= >= clauses. Perhaps, but I doubt it would

Re: Super PathKeys (Allowing sort order through precision loss functions)

2018-10-31 Thread Andres Freund
Hi, On 2018-11-01 12:19:32 +1300, David Rowley wrote: > On 1 November 2018 at 12:11, Tomas Vondra > wrote: > > I still have trouble imagining what exactly would the function do to > > determine if the optimization can be applied to substr() and similar > > collation-dependent cases. > > I

Re: Super PathKeys (Allowing sort order through precision loss functions)

2018-10-31 Thread David Rowley
On 1 November 2018 at 12:11, Tomas Vondra wrote: > I still have trouble imagining what exactly would the function do to > determine if the optimization can be applied to substr() and similar > collation-dependent cases. I guess the function would have to check for a Const offset of 0, and a

Re: Super PathKeys (Allowing sort order through precision loss functions)

2018-10-31 Thread Tomas Vondra
On 10/31/2018 10:07 PM, David Rowley wrote: > On 1 November 2018 at 05:40, Robert Haas wrote: >> This kinda reminds me of commit >> 8f9fe6edce358f7904e0db119416b4d1080a83aa. We needed a way to provide >> the planner with knowledge about the behavior of specific functions. >> In that case, the

Re: Super PathKeys (Allowing sort order through precision loss functions)

2018-10-31 Thread Nasby, Jim
> On Oct 30, 2018, at 9:08 AM, Simon Riggs wrote: > > On Tue, 30 Oct 2018 at 07:58, David Rowley > wrote: > > I've started working on something I've ended up calling "Super > PathKeys". The idea here is to increase the likelihood of a Path with > PathKeys being used for a purpose that

Re: Super PathKeys (Allowing sort order through precision loss functions)

2018-10-31 Thread David Rowley
On 1 November 2018 at 05:40, Robert Haas wrote: > This kinda reminds me of commit > 8f9fe6edce358f7904e0db119416b4d1080a83aa. We needed a way to provide > the planner with knowledge about the behavior of specific functions. > In that case, the specific need was to be able to tell the planner >

Re: Super PathKeys (Allowing sort order through precision loss functions)

2018-10-31 Thread Tom Lane
Robert Haas writes: > This kinda reminds me of commit > 8f9fe6edce358f7904e0db119416b4d1080a83aa. We needed a way to provide > the planner with knowledge about the behavior of specific functions. > In that case, the specific need was to be able to tell the planner > that a certain function call

Re: Super PathKeys (Allowing sort order through precision loss functions)

2018-10-31 Thread Tomas Vondra
On 10/31/2018 04:32 AM, David Rowley wrote: On 31 October 2018 at 14:23, Tomas Vondra wrote: The other thing likely affecting this is locale / collation. Probably not for date_trunc, but certainly for things like substr()/trim(), mentioned by Simon upthread. In some languages the rules are

Re: Super PathKeys (Allowing sort order through precision loss functions)

2018-10-30 Thread David Rowley
On 31 October 2018 at 14:23, Tomas Vondra wrote: > The other thing likely affecting this is locale / collation. Probably > not for date_trunc, but certainly for things like substr()/trim(), > mentioned by Simon upthread. > > In some languages the rules are pretty complex, and there's no chance >

Re: Super PathKeys (Allowing sort order through precision loss functions)

2018-10-30 Thread Tomas Vondra
Hi, On 10/30/2018 11:41 PM, David Rowley wrote: > On 31 October 2018 at 08:52, Tom Lane wrote: >> David Rowley writes: >>> I've started working on something I've ended up calling "Super >>> PathKeys". The idea here is to increase the likelihood of a Path with >>> PathKeys being used for a

Re: Super PathKeys (Allowing sort order through precision loss functions)

2018-10-30 Thread David Rowley
On 31 October 2018 at 08:52, Tom Lane wrote: > David Rowley writes: >> I've started working on something I've ended up calling "Super >> PathKeys". The idea here is to increase the likelihood of a Path with >> PathKeys being used for a purpose that requires a less strict sort >> order due to

Re: Super PathKeys (Allowing sort order through precision loss functions)

2018-10-30 Thread Tom Lane
David Rowley writes: > I've started working on something I've ended up calling "Super > PathKeys". The idea here is to increase the likelihood of a Path with > PathKeys being used for a purpose that requires a less strict sort > order due to ordering being required from the return value of some

Re: Super PathKeys (Allowing sort order through precision loss functions)

2018-10-30 Thread Simon Riggs
On Tue, 30 Oct 2018 at 07:58, David Rowley wrote: > I've started working on something I've ended up calling "Super > PathKeys". The idea here is to increase the likelihood of a Path with > PathKeys being used for a purpose that requires a less strict sort > order due to ordering being required

Super PathKeys (Allowing sort order through precision loss functions)

2018-10-30 Thread David Rowley
Dear Hackers, I've started working on something I've ended up calling "Super PathKeys". The idea here is to increase the likelihood of a Path with PathKeys being used for a purpose that requires a less strict sort order due to ordering being required from the return value of some precision loss