From: Paul Jungwirth <pj@illuminatedcomputing.com>
To: hmidi slim <hmidi.slim2@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Proposition for better performance
Date: Tue, 27 Mar 2018 10:31:12 -0700
Message-ID: <834d8a70-386d-7101-f846-ae572140af92@illuminatedcomputing.com> (raw)
In-Reply-To: <CAMsqVxtRD5dCVL3o_eCWNdwo4igQCzjMgXTdD+sDVD8AHHkgDg@mail.gmail.com>
References: <CAMsqVxs8xwxH+f40nUNj+5L9Mo9+9z+xsjFxS0k+ajgG=qOz4Q@mail.gmail.com>
<2e436152-eda0-d67d-4b20-90da0db4a049@illuminatedcomputing.com>
<CAMsqVxtRD5dCVL3o_eCWNdwo4igQCzjMgXTdD+sDVD8AHHkgDg@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: pj@illuminatedcomputing.com, hmidi.slim2@gmail.com
Subject: Re: Proposition for better performance
In-Reply-To: <834d8a70-386d-7101-f846-ae572140af92@illuminatedcomputing.com>
References: <CAMsqVxs8xwxH+f40nUNj+5L9Mo9+9z+xsjFxS0k+ajgG=qOz4Q@mail.gmail.com> <2e436152-eda0-d67d-4b20-90da0db4a049@illuminatedcomputing.com> <CAMsqVxtRD5dCVL3o_eCWNdwo4igQCzjMgXTdD+sDVD8AHHkgDg@mail.gmail.com> <834d8a70-386d-7101-f846-ae572140af92@illuminatedcomputing.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox