Re: BUG #15577: Query returns different results when executed multiple times

Thomas Munro <thomas.munro@enterprisedb.com>

From: Thomas Munro <thomas.munro@enterprisedb.com>
To: Bartosz Polnik <bartoszpolnik@gmail.com>
Cc: David Rowley <david.rowley@2ndquadrant.com>, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2019-01-09T01:52:45Z
Lists: pgsql-bugs
On Tue, Jan 8, 2019 at 10:45 PM Bartosz Polnik <bartoszpolnik@gmail.com> wrote:
> SET force_parallel_mode = off;
> SET parallel_leader_participation = off;
>
> alter table_c set (parallel_workers=2);
> ...
>
> 31 rows - correct result.

Huh.  So now we have:

1.  Leader only (max_parallel_workers = 0): OK
2.  Worker only (parallel_leader_participation = off, parallel_workers = 2): OK
3.  Leader + worker: broken, short results
4.  Worker only with slightly different plan (force_parallel_mode = on): OK

Ahh, I just reproduced this.  Take mockup_bug15577.sql (Bartosz's
version) and then do this:

insert into table_c select * from table_c;

insert into table_b
select generate_series(1000000, 1000010), 100112, 'A', 99888,
'2018-09-01', true,
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';

Now the number of results from the query in the script is not stable,
varying between 235 or 246 results for me.  Not sure what's going on
yet.

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


Commits

  1. Avoid sharing PARAM_EXEC slots between different levels of NestLoop.