On Fri, 4 Sep 2020 at 20:21, Yang, Rong <yangr.fnst@cn.fujitsu.com> wrote:
> in OSS 10, how to make the top plan of the plan tree to GatherMerge with ‘except all’ in sql?
(I guess you're talking about PostgreSQL 10. I'm not sure what OSS 10 is.)
The ability for Gather Merge to work with Init Plan values was only
added in [1], which was new to PostgreSQL 11. So you're not going to
make that work in PostgreSQL 10.
You could try crafting the query in such a way that an Init plan is
not used. e.g a CROSS JOIN, but not sure if that'll improve your
performance any. So you could try reducing the parallel_tuple_cost a
bit, which might give you a Gather, so at least the Seq Scan will be
done in parallel. The sort will still be serial though.
A btree index on table1 (c) looks like it might be worth considering.
David
[1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=e89a71fb44