Parallel execution and prepared statements

Albe Laurenz <laurenz.albe@wien.gv.at>

From: Albe Laurenz <laurenz.albe@wien.gv.at>
To: "'pgsql-hackers@postgresql.org'" <pgsql-hackers@postgresql.org>
Cc: "'t.bussmann@gmx.net'" <t.bussmann@gmx.net>
Date: 2016-11-15T15:41:18Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Enable parallelism for prepared statements and extended query protocol.

Attachments

Tobias Bussmann has discovered an oddity with prepared statements.

Parallel scan is used with prepared statements, but only if they have
been created with protocol V3 "Parse".
If a prepared statement has been prepared with the SQL statement PREPARE,
it will never use a parallel scan.

I guess that is an oversight in commit 57a6a72b, right?
PrepareQuery in commands/prepare.c should call CompleteCachedPlan
with cursor options CURSOR_OPT_PARALLEL_OK, just like
exec_prepare_message in tcop/postgres.c does.

The attached patch fixes the problem for me.

Yours,
Laurenz Albe