Optimize constant MinMax expressions

From: Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Optimize constant MinMax expressions
Date: 2018-12-29 21:40:14
Message-ID: c6e8504c-4c43-35fa-6c8f-3c0b80a912cc@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 came up with the attached patch to fix it, but it's so ridiculously
small that I fear I'm missing something.

I don't think this needs any documentation and I didn't see where we
have any existing tests for eval_const_expressions so I didn't create
any either.

Thoughts?
--
Vik Fearing +33 6 46 75 15 36
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

Attachment Content-Type Size
optimize_constant_least_greatest.v01.patch text/x-patch 436 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2018-12-29 21:59:52 Re: reducing the footprint of ScanKeyword (was Re: Large writable variables)
Previous Message Tom Lane 2018-12-29 21:07:15 Re: random() (was Re: New GUC to sample log queries)