Problem in Parallel Bitmap Heap Scan?

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Problem in Parallel Bitmap Heap Scan?
Date: 2017-03-21 11:17:58
Message-ID: CAEepm=19Cmnfbi-j2Bw-a6yGPeHE1OVhKvvKz9bRBTJGKfGHMA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I noticed a failure in the inet.sql test while running the regression
tests with parallelism cranked up, and can reproduce it interactively
as follows. After an spgist index is created and the plan changes to
the one shown below, the query returns no rows.

regression=# set force_parallel_mode = regress;
SET
regression=# set max_parallel_workers_per_gather = 2;
SET
regression=# set parallel_tuple_cost = 0;
SET
regression=# set parallel_setup_cost = 0;
SET
regression=# set min_parallel_table_scan_size = 0;
SET
regression=# set min_parallel_index_scan_size = 0;
SET
regression=# set enable_seqscan = off;
SET
regression=# SELECT * FROM inet_tbl WHERE i <> '192.168.1.0/24'::cidr
ORDER BY i;

c | i
--------------------+------------------
10.0.0.0/8 | 9.1.2.3/8
10.0.0.0/8 | 10.1.2.3/8
10.0.0.0/32 | 10.1.2.3/8
10.0.0.0/8 | 10.1.2.3/8
10.1.0.0/16 | 10.1.2.3/16
10.1.2.0/24 | 10.1.2.3/24
10.1.2.3/32 | 10.1.2.3
10.0.0.0/8 | 11.1.2.3/8
192.168.1.0/24 | 192.168.1.226/24
192.168.1.0/24 | 192.168.1.255/24
192.168.1.0/24 | 192.168.1.0/25
192.168.1.0/24 | 192.168.1.255/25
192.168.1.0/26 | 192.168.1.226
10.0.0.0/8 | 10::/8
::ffff:1.2.3.4/128 | ::4.3.2.1/24
10:23::f1/128 | 10:23::f1/64
10:23::8000/113 | 10:23::ffff
(17 rows)

regression=# CREATE INDEX inet_idx3 ON inet_tbl using spgist (i);
CREATE INDEX
regression=# SELECT * FROM inet_tbl WHERE i <> '192.168.1.0/24'::cidr
ORDER BY i;
c | i
---+---
(0 rows)

regression=# explain SELECT * FROM inet_tbl WHERE i <>
'192.168.1.0/24'::cidr ORDER BY i;
QUERY PLAN
-----------------------------------------------------------------------------------------
Gather Merge (cost=16.57..16.67 rows=10 width=64)
Workers Planned: 1
-> Sort (cost=16.56..16.58 rows=10 width=64)
Sort Key: i
-> Parallel Bitmap Heap Scan on inet_tbl (cost=12.26..16.39
rows=10 width=64)
Recheck Cond: (i <> '192.168.1.0/24'::inet)
-> Bitmap Index Scan on inet_idx3 (cost=0.00..12.26
rows=17 width=0)
Index Cond: (i <> '192.168.1.0/24'::inet)
(8 rows)

--
Thomas Munro
http://www.enterprisedb.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2017-03-21 11:21:11 postgres_fdw: correct regression test for parameterized scan for foreign table
Previous Message Ashutosh Sharma 2017-03-21 11:00:54 Re: segfault in hot standby for hash indexes