From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: select_parallel test fails with nonstandard block size
Date: Thu, 15 Sep 2016 11:46:53 -0400
Message-ID: <479.1473954413@sss.pgh.pa.us> (raw)
In-Reply-To: <10511.1473951945@sss.pgh.pa.us>
References: <90634e20-097a-e4fd-67d5-fb2c42f0dd71@2ndquadrant.com>
<7617.1473947997@sss.pgh.pa.us>
<CA+TgmoZ2w1=6KkpSpdMSxkrDezWXSq5t37HhnZ_Syj4d0MfRvA@mail.gmail.com>
<9703.1473950664@sss.pgh.pa.us>
<CA+TgmoZUD=c4sw9CynJYxNgdTFZ-Q1JCuYJ-RdTm_3URwo=xtg@mail.gmail.com>
<10511.1473951945@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
I wrote:
> OK, I'll take care of it (since I now realize that the inconsistency
> is my own fault --- I committed that GUC not you). It's unclear what
> this will do for Peter's complaint though.
On closer inspection, the answer is "nothing", because the select_parallel
test overrides the default value of min_parallel_relation_size anyway.
(Without that, I don't think tenk1 is large enough to trigger
consideration of parallel scan at all.)
I find that at BLCKSZ 8K, the planner thinks the best plan is
HashAggregate (cost=5320.28..7920.28 rows=10000 width=12)
Group Key: parallel_restricted(unique1)
-> Index Only Scan using tenk1_unique1 on tenk1 (cost=0.29..2770.28 rows=10000 width=8)
which is what the regression test script expects. Forcing the parallel
plan to be chosen, we get this using the cost parameters set up by
select_parallel:
HashAggregate (cost=5433.00..8033.00 rows=10000 width=12)
Group Key: parallel_restricted(unique1)
-> Gather (cost=0.00..2883.00 rows=10000 width=8)
Workers Planned: 4
-> Parallel Seq Scan on tenk1 (cost=0.00..383.00 rows=2500 width=4)
However, at BLCKSZ 16K, we get these numbers instead:
HashAggregate (cost=5264.28..7864.28 rows=10000 width=12)
Group Key: parallel_restricted(unique1)
-> Index Only Scan using tenk1_unique1 on tenk1 (cost=0.29..2714.28 rows=10000 width=8)
HashAggregate (cost=5251.00..7851.00 rows=10000 width=12)
Group Key: parallel_restricted(unique1)
-> Gather (cost=0.00..2701.00 rows=10000 width=8)
Workers Planned: 4
-> Parallel Seq Scan on tenk1 (cost=0.00..201.00 rows=2500 width=4)
so the planner goes for the second one.
I don't think there's anything particularly broken here. The seqscan
cost estimate is largely dependent on the number of blocks, and there's
half as many blocks at 16K. The indexscan estimate is also reduced,
but not as much, so it stops looking like the cheaper alternative.
We could maybe twiddle the cost parameters select_parallel uses so that
the same plan is chosen at both block sizes, but it seems like it would
be very fragile, and I'm not sure there's much point.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
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-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, peter.eisentraut@2ndquadrant.com, robertmhaas@gmail.com
Subject: Re: select_parallel test fails with nonstandard block size
In-Reply-To: <479.1473954413@sss.pgh.pa.us>
References: <90634e20-097a-e4fd-67d5-fb2c42f0dd71@2ndquadrant.com> <7617.1473947997@sss.pgh.pa.us> <CA+TgmoZ2w1=6KkpSpdMSxkrDezWXSq5t37HhnZ_Syj4d0MfRvA@mail.gmail.com> <9703.1473950664@sss.pgh.pa.us> <CA+TgmoZUD=c4sw9CynJYxNgdTFZ-Q1JCuYJ-RdTm_3URwo=xtg@mail.gmail.com> <10511.1473951945@sss.pgh.pa.us> <479.1473954413@sss.pgh.pa.us>
* 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