Questions tagged [range-types]
The range-types tag has no usage guidance.
5
questions
30
votes
5
answers
15k
views
Combining separate ranges into largest possible contiguous ranges
I'm trying to combine multiple date ranges (my load is about max 500, most cases 10) that may or may not overlap into the largest possible contiguous date ranges. For example:
Data:
CREATE TABLE ...
1
vote
1
answer
1k
views
How to use index for simple time range join?
I have a large (~ 100 million rows) timeseries table t_16 in Postgres 11.5 where the primary key is a field abs_date_time of type timestamp.
This is a follow up of this question:
Why does a CTE ...
4
votes
1
answer
1k
views
Index not used for date range condition
I was querying like this:
SELECT count(*)
FROM orders
WHERE planned_shipping_date >= '2022-04-04'
AND planned_shipping_date < '2022-04-05'
Then I came across this answer and, because in more ...
3
votes
1
answer
3k
views
Updating table of versioned rows with historical records in PostgreSQL
I have a master table of versioned rows:
CREATE TABLE master (
id SERIAL PRIMARY KEY,
rec_id integer,
val text,
valid_on date[],
valid_during daterange
);
INSERT INTO master (...
2
votes
1
answer
199
views
Ranges over domains do not trigger implicit casting
As far as I was able to find out, it is currently not possible in PostgreSQL v9.5 (and above?) to obtain implicit casting with custom range types. To illustrate,
when I define the following demo setup:...