Re: Parallel bitmap heap scan
Dilip Kumar <dilipbalaut@gmail.com>
From: Dilip Kumar <dilipbalaut@gmail.com>
To: tushar <tushar.ahuja@enterprisedb.com>
Cc: Amit Khandekar <amitdkhan.pg@gmail.com>,
Amit Kapila <amit.kapila16@gmail.com>, Andres Freund <andres@anarazel.de>, Robert Haas <robertmhaas@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2017-01-10T11:46:00Z
Lists: pgsql-hackers
Attachments
- 0001-opt-parallelcost-refactoring-v9.patch (application/octet-stream) patch v9-0001
- 0002-hash-support-alloc-free-v9.patch (application/octet-stream) patch v9-0002
- 0003-parallel-bitmap-heap-scan-v9.patch (application/octet-stream) patch v9-0003
- (unnamed) (text/plain)
On Tue, Jan 10, 2017 at 2:19 PM, tushar <tushar.ahuja@enterprisedb.com> wrote:
> We found a regression , earlier the testcase was working fine (against the
> older patches of Parallel bitmap heap scan) but now getting a server crash
> against v8 patches.
>
> Testcase - (one of the table of TPC-H )
>
> postgres=#explain analyze verbose
> SELECT SUM(l_extendedprice) FROM lineitem
> WHERE (l_shipdate >= '1995-01-01'::date)
> AND (l_shipdate <='1996-03-31'::date);
While fixing some of the review comments in v7 and v8, I had allocated
new memory for pagetable, and missed to initialize it.
Thanks for reporting, I have fixed it in v9. After fix query is
running fine for me. Please try attached patch and confirm from your
side.
postgres=# explain analyze verbose
SELECT SUM(l_extendedprice) FROM lineitem
WHERE (l_shipdate >= '1995-01-01'::date)
AND (l_shipdate <='1996-03-31'::date);
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------------------------------
-----------
Finalize Aggregate (cost=798002.46..798002.47 rows=1 width=32)
(actual time=15501.245..15501.245 rows=1 loops=1)
Output: sum(l_extendedprice)
-> Gather (cost=798002.24..798002.45 rows=2 width=32) (actual
time=15494.358..15498.919 rows=3 loops=1)
Output: (PARTIAL sum(l_extendedprice))
Workers Planned: 2
Workers Launched: 2
-> Partial Aggregate (cost=797002.24..797002.25 rows=1
width=32) (actual time=15492.937..15492.937 rows=1 loops=3)
Output: PARTIAL sum(l_extendedprice)
Worker 0: actual time=15491.218..15491.219 rows=1 loops=1
Worker 1: actual time=15493.514..15493.514 rows=1 loops=1
-> Parallel Bitmap Heap Scan on public.lineitem
(cost=147461.75..791014.31 rows=2395170 width=8) (actual
time=8553.301..15061.333 rows=189294
7 loops=3)
Output: l_extendedprice
Recheck Cond: ((lineitem.l_shipdate >=
'1995-01-01'::date) AND (lineitem.l_shipdate <= '1996-03-31'::date))
Rows Removed by Index Recheck: 6451177
Heap Blocks: exact=27963 lossy=164938
Worker 0: actual time=8548.957..15054.511
rows=1887239 loops=1
Worker 1: actual time=8554.817..15050.317
rows=1902477 loops=1
-> Bitmap Index Scan on idx_lineitem_shipdate
(cost=0.00..146024.65 rows=5748409 width=0) (actual
time=8533.701..8533.701 rows=5678841
loops=1)
Index Cond: ((lineitem.l_shipdate >=
'1995-01-01'::date) AND (lineitem.l_shipdate <= '1996-03-31'::date))
Planning time: 2.742 ms
Execution time: 15509.696 ms
(21 rows)
--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com
Commits
-
Pass DSA_ALLOC_HUGE when allocating a shared TIDBitmap.
- a171f01501e1 10.0 landed
-
Support parallel bitmap heap scans.
- f35742ccb7aa 10.0 landed
-
tidbitmap: Support shared iteration.
- 98e6e89040a0 10.0 landed
-
Shut down Gather's children before shutting down Gather itself.
- acf555bc53ac 10.0 landed
-
Revise the way the element allocator for a simplehash is specified.
- c3c4f6e1740b 10.0 cited
-
Refactor bitmap heap scan estimation of heap pages fetched.
- da08a6598973 10.0 landed
-
Use more efficient hashtable for tidbitmap.c to speed up bitmap scans.
- 75ae538bc316 10.0 cited