Re: how to get top plan of GatherMerge in OSS10

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: "Yang, Rong" <yangr(dot)fnst(at)cn(dot)fujitsu(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: how to get top plan of GatherMerge in OSS10
Date: 2020-09-04 10:59:14
Message-ID: CAApHDvqK4=piMm4Gc9OGGxqq1MM9DVTPyEXPy4=OsJfDbD1rnQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 4 Sep 2020 at 20:21, Yang, Rong <yangr(dot)fnst(at)cn(dot)fujitsu(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Klaudie Willis 2020-09-04 11:42:51 Bitmap scan seem like such a strange choice when "limit 1"
Previous Message Karsten Hilbert 2020-09-04 10:59:04 Aw: Implement a new data type