Re: Proposition for better performance - Mailing list pgsql-general

From hmidi slim
Subject Re: Proposition for better performance
Date
Msg-id CAMsqVxtRD5dCVL3o_eCWNdwo4igQCzjMgXTdD+sDVD8AHHkgDg@mail.gmail.com
Whole thread Raw
In response to Re: Proposition for better performance  (Paul Jungwirth <pj@illuminatedcomputing.com>)
Responses Re: Proposition for better performance  (Paul Jungwirth <pj@illuminatedcomputing.com>)
List pgsql-general
the query that I used to fetch products was:
select * from availability
where ('27-03-2018' between start_date and end_date)
and ('31-03-2018' between start_date and end_date);

I added another column named during of type daterange and I created a gist index :
create index idx on availability(during);

select * from availability
where during @> daterange(''27-03-2018', '31-03-2018');

With a table of 15M rows I got an execution time of 1 minute.Thtat's why I asked if it is a good solution to divide the availability of a product by intervals.
If I assume that a product has in every month 5 availability intervals, in 12 months we will have 60 intervals.For 1M products that's will be 60M rows. This will affect the performance.

pgsql-general by date:

Previous
From: Steve Rogerson
Date:
Subject: Re: Check constraints.
Next
From: Paul Jungwirth
Date:
Subject: Re: Proposition for better performance