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@xxxxxxxxxxxxxxxxxxxxxxxx