Re: "two time periods with only an endpoint in common do not overlap" ???

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: Ron <ronljohnsonjr(at)gmail(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: "two time periods with only an endpoint in common do not overlap" ???
Date: 2021-10-17 09:50:45
Message-ID: CA+bJJbyWKXTa655qaE=xy7ZBf5aWWbQWVKFhnPeMJWif7_yDXQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ron:

On Fri, 15 Oct 2021 at 20:16, Ron <ronljohnsonjr(at)gmail(dot)com> wrote:
> > so no overlap.
> I was afraid you were going to say that. It's completely bizarre, but seems
> to be a "thing" in computer science.

Right half open intervals are normally choosed because they can fully
cover the real line without overlap. Full open and full closed can
not.

When you have timestamps, or float/doubles, you are trying to
represent a point on a (time) line, although their finite computer
representation is countable.

When you use dates / integers you can use any kind of intervales, as
they are countable, but it is easier if you use the same
representation.

When I do billing I select monthly CDRs in one system on a condicion
on a timestamp column, {setup >= '2021-05-01' and setup<'2021-06-01'}.
Another system as split date/time, and I select on that table using
the same limits, { fecha >= '2021-05-01' and fecha<'2021-06-01' }. I
could use a full closed interval, but half open is easier.

Also, if you cover the countable set of dates with half-open intervals
it has the nice property of having start-range(i)=end_range(i-1),
which is much easier to program.

And half open are easier to generate. If you want to generate 12
element ranges starting at 1 you can do something like

for i=1 to 100 step 12
print i, i+12

which nicely lets you see they are dozens, if you use closed you need
to "print i, i+11" or "print i, i+12-1".

In general it is a thing because it is easier.

FOS

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Florents Tselai 2021-10-17 15:12:17 Force re-compression with lz4
Previous Message Thomas Munro 2021-10-17 02:30:08 Re: Wrong sorting on docker image