Sorry for the duplicated thread here and thanks for the reply.
I have another question regarding parallel execution. We noticed that PostgreSQL sometimes launches only one worker. Is that also an intended behavior?
Best regards,
Jinho Jung
On Mon, Apr 1, 2019 at 3:00 PM Andres Freund <andres@anarazel.de> wrote:
Hi,
On 2019-04-01 11:52:54 -0700, Peter Geoghegan wrote: > On Mon, Apr 1, 2019 at 11:30 AM Jinho Jung <jinhojun@usc.edu> wrote: > > Surprisingly, we found that even on a larger TPC-C database (scale factor of 50, roughly 4GB of size), parallel scan is still slower than the non-parallel execution plan in the old version. > > That's not a large database, and it's certainly not a large TPC-C > database. If you attempt to stay under the spec's maximum > tpmC/throughput per warehouse, which is 12.86 tpmC per warehouse, then > you'll need several thousand warehouses on modern hardware. We're > talking several hundred gigabytes. Otherwise, as far as the spec is > concerned you're testing an unrealistic workload. There will be > individual customers that make many more purchases than is humanly > possible. You're modelling an app involving hypothetical warehouse > employees that must enter data into their terminals at a rate that is > not humanly possible.
I don't think that's really the problem here. It's that there's a fundamental misestimation in the query:
note the estimated rows=100000 vs the actual rows=1 in the seqscan / materialize. That's what makes the planner think this is much more expensive than it is, which in turn triggers the use of a parallel scan.