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

From Paul Jungwirth
Subject Re: Proposition for better performance
Date
Msg-id 834d8a70-386d-7101-f846-ae572140af92@illuminatedcomputing.com
Whole thread Raw
In response to Re: Proposition for better performance  (hmidi slim <hmidi.slim2@gmail.com>)
List pgsql-general
On 03/27/2018 10:04 AM, hmidi slim wrote:
> 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);

That creates a b-tree index.

Also, what did you set `during` to?

> 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.

What was the query plan? Did you confirm that it used the index?

-- 
Paul              ~{:-)
pj@illuminatedcomputing.com


pgsql-general by date:

Previous
From: hmidi slim
Date:
Subject: Re: Proposition for better performance
Next
From: Ken Beck
Date:
Subject: Postgresql 9.3 Server will not start after Ubuntu Upgrade