Unneeded parallel safety tests in grouping_planner

From: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Unneeded parallel safety tests in grouping_planner
Date: 2019-02-27 12:45:29
Message-ID: 5C768669.8070207@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Yet another thing I noticed while working on [1] is this in
grouping_planner:

/*
* If the input rel is marked consider_parallel and there's nothing
that's
* not parallel-safe in the LIMIT clause, then the final_rel can be
marked
* consider_parallel as well. Note that if the query has rowMarks or is
* not a SELECT, consider_parallel will be false for every relation
in the
* query.
*/
if (current_rel->consider_parallel &&
is_parallel_safe(root, parse->limitOffset) &&
is_parallel_safe(root, parse->limitCount))
final_rel->consider_parallel = true;

If there is a need to add a LIMIT node, we don't consider generating
partial paths for the final relation below (see commit
0927d2f46ddd4cf7d6bf2cc84b3be923e0aedc52), so it seems unnecessary
anymore to assess the parallel-safety of the LIMIT and OFFSET clauses.
To save cycles, why not remove those tests from that function like the
attached?

Best regards,
Etsuro Fujita

[1] https://commitfest.postgresql.org/22/1950/

Attachment Content-Type Size
unneeded-parallel-safety-tests.patch text/x-patch 2.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Prabhat Sahu 2019-02-27 13:38:53 pg_dump/pg_restore fail for TAR_DUMP and CUSTOM_DUMP from v94/v95/v96 to v11/master.
Previous Message Alvaro Herrera 2019-02-27 12:32:17 Re: Segfault when restoring -Fd dump on current HEAD