From: | Adam Jensen <hanzer(at)riseup(dot)net> |
---|---|
To: | pgsql-sql(at)lists(dot)postgresql(dot)org |
Subject: | Re: interval origami |
Date: | 2018-12-01 20:37:46 |
Message-ID: | 60f4dcd0-bd8c-f7ba-cf77-e1640f3f5dc0@riseup.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On 12/1/18 8:24 AM, Joe Conway wrote:
> Perhaps overkill, but if you represent your timeline as actual line
> segments, perhaps PostGIS would be useful. E.g.:
>
> https://postgis.net/docs/manual-2.5/ST_Difference.html
That's an interesting notion. Thanks, Joe!
I think I learned enough about plpgsql programming last night to write
the three basic functions that each operate on two time intervals:
1. determine if two intervals overlap
2. merge two overlapping intervals into one interval
3. given two overlapping intervals, produce the difference interval or
interval set
My thinking here is that since these functions seem to be
computationally simple, it might be more convenient for exploration,
development, distribution and maintenance if there is some uniformity in
their style and control over their implementation and behavior.
Currently, I am thinking about how these functions might be used to
solve the problem. Since I am not familiar with the capabilities of SQL,
my tendency is to think in terms of a function that iterates over the
data set multiple times and eventually converges to produce the solution
set. I am concerned that this might be a very goofy way to solve the
problem in a relational database.
From | Date | Subject | |
---|---|---|---|
Next Message | Steve Midgley | 2018-12-02 01:23:17 | Re: interval origami |
Previous Message | Joe Conway | 2018-12-01 13:24:25 | Re: interval origami |