| From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
|---|---|
| To: | Alexandre Felipe <o(dot)alexandre(dot)felipe(at)gmail(dot)com> |
| Cc: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: SLOPE - Planner optimizations on monotonic expressions. |
| Date: | 2026-03-26 18:17:11 |
| Message-ID: | CAEZATCXHYc_NGLNbvn5Uj8JU2XCXME=JTjT_M9amCPwZWGrNvA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, 25 Mar 2026 at 23:35, Alexandre Felipe
<o(dot)alexandre(dot)felipe(at)gmail(dot)com> wrote:
>
> Good catch,
> Can you think of any other type that would wrap,
Arithmetic with intervals isn't monotonic in general because of the
way interval time units vary.
For example, '1 month - 29 days' is "positive" (in the sense that it
compares as greater than zero, and it compares equal to an interval of
'1 day'), but adding it to a date or timestamp may go forwards or
backwards, or not move at all, depending on the number of days in the
month.
Another example, is the interval '361 days', which compares as greater
than the interval '1 year' (because that's taken to be 12 months of 30
days each). But adding '361 days' to a date or timestamp advances it
by less than a year.
So ordering by an interval column can produce different results than
ordering by a fixed date/timestamp plus the interval.
Regards,
Dean
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nathan Bossart | 2026-03-26 18:21:41 | Re: remove bits* types |
| Previous Message | Tom Lane | 2026-03-26 18:14:03 | Re: DOCS - Add introductory paragraph to Getting Started chapter |