Re: Optimize constant MinMax expressions

2018-12-30 Thread Vik Fearing
On 30/12/2018 19:44, Tom Lane wrote: > Vik Fearing writes: >> On 30/12/2018 00:36, Tom Lane wrote: >>> Can we assume that the underlying datatype comparison function is >>> immutable? I guess so, since we assume that in nearby code such as >>> contain_mutable_functions_walker, but I don't think i

Re: Optimize constant MinMax expressions

2018-12-30 Thread Tom Lane
Vik Fearing writes: > On 30/12/2018 00:36, Tom Lane wrote: >> Can we assume that the underlying datatype comparison function is >> immutable? I guess so, since we assume that in nearby code such as >> contain_mutable_functions_walker, but I don't think it should be done >> without at least a comm

Re: Optimize constant MinMax expressions

2018-12-30 Thread Vik Fearing
On 30/12/2018 00:36, Tom Lane wrote: > Vik Fearing writes: >> I was working on a little thing where I needed to simulate BETWEEN >> SYMMETRIC so naturally I used least() and greatest(). I was a little >> surprised to see that my expressions were not folded into straight >> constants and the estim

Re: Optimize constant MinMax expressions

2018-12-29 Thread Tom Lane
Vik Fearing writes: > I was working on a little thing where I needed to simulate BETWEEN > SYMMETRIC so naturally I used least() and greatest(). I was a little > surprised to see that my expressions were not folded into straight > constants and the estimates were way off as a consequence. > I ca