Re: Proposition for better performance

From: Paul Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: hmidi slim <hmidi(dot)slim2(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Proposition for better performance
Date: 2018-03-27 17:31:12
Message-ID: 834d8a70-386d-7101-f846-ae572140af92@illuminatedcomputing.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)illuminatedcomputing(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ken Beck 2018-03-27 18:00:09 Postgresql 9.3 Server will not start after Ubuntu Upgrade
Previous Message hmidi slim 2018-03-27 17:04:55 Re: Proposition for better performance