pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
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 11:36:12 -0700
Message-ID: <072ceb55-6b57-7f9d-78a7-308a03bedc55@illuminatedcomputing.com> (raw)
In-Reply-To: <CAMsqVxtg-qZizp==Y3hO-Js7buHMqZJj8MiuYuvUUVoJHo+YOg@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>
	<834d8a70-386d-7101-f846-ae572140af92@illuminatedcomputing.com>
	<CAMsqVxu2jFANWNDnFRUnM76NS70_u+VrwhmPOiK9U97FK9sm8w@mail.gmail.com>
	<CAMsqVxtg-qZizp==Y3hO-Js7buHMqZJj8MiuYuvUUVoJHo+YOg@mail.gmail.com>

On 03/27/2018 11:14 AM, hmidi slim wrote:
> Query plan:*
> Bitmap Heap Scan on product_availabilities  (cost=33728.79..236086.04 
> rows=878500 width=26) (actual time=2775.058..5792.842 rows=15000000 loops=1)
>    Recheck Cond: (during @> '[2018-02-01,2018-04-01)'::daterange)
>    Heap Blocks: exact=31040 lossy=79255
>    ->  Bitmap Index Scan on idx_time  (cost=0.00..33509.17 rows=878500 
> width=0) (actual time=2767.262..2767.262 rows=15000000 loops=1)
>          Index Cond: (during @> '[2018-02-01,2018-04-01)'::daterange)
> Planning time: 0.063 ms
> Execution time: 6408.456 ms
> 
> 
> *SELECT product_id, start_date, end_date, during
>      FROM product_availabilities
>      WHERE during @> daterange('2018-02-01', '2018-04-01')*
> *
> returns  query runtime*: 2min
> *

It is 6 seconds or 2 minutes? Where is the 2 minutes number coming from? 
Are you sure that's all Postgres? With 878k rows even sending them over 
the network is going to take a while, and then more time to JSONify them 
or whatever else you need to do.

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




view thread (10+ messages)  latest in thread

Message-ID: <072ceb55-6b57-7f9d-78a7-308a03bedc55@illuminatedcomputing.com>
Permalink:  ../072ceb55-6b57-7f9d-78a7-308a03bedc55@illuminatedcomputing.com/
Also on:    postgresql.org/message-id/072ceb55-6b57-7f9d-78a7-308a03bedc55@illuminatedcomputing.com

 · 

reply

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: <072ceb55-6b57-7f9d-78a7-308a03bedc55@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> <CAMsqVxu2jFANWNDnFRUnM76NS70_u+VrwhmPOiK9U97FK9sm8w@mail.gmail.com> <CAMsqVxtg-qZizp==Y3hO-Js7buHMqZJj8MiuYuvUUVoJHo+YOg@mail.gmail.com> <072ceb55-6b57-7f9d-78a7-308a03bedc55@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