Parallel execution and prepared statements

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Cc: "'t(dot)bussmann(at)gmx(dot)net'" <t(dot)bussmann(at)gmx(dot)net>
Subject: Parallel execution and prepared statements
Date: 2016-11-15 15:41:18
Message-ID: A737B7A37273E048B164557ADEF4A58B5397E86F@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
0001-Consider-parallel-plans-for-statements-prepared-with.patch application/octet-stream 885 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2016-11-15 15:41:20 Re: proposal: psql \setfileref
Previous Message Jim Nasby 2016-11-15 15:10:53 Re: Danger of automatic connection reset in psql