Skip to content

Commit 57a6a72

Browse files
committed
Enable parallelism for prepared statements and extended query protocol.
Parallel query can't handle running a query only partially rather than to completion. However, there seems to be no way to run a statement prepared via SQL PREPARE other than to completion, so we can enable it there without a problem. The situation is more complicated for the extend query protocol. libpq seems to provide no way to send an Execute message with a non-zero rowcount, but some other client might. If that happens, and a parallel plan was chosen, we'll execute the parallel plan without using any workers, which may be somewhat inefficient but should still work. Hopefully this won't be a problem; users can always set max_parallel_degree=0 to avoid choosing parallel plans in the first place. Amit Kapila, reviewed by me.
1 parent 25924ac commit 57a6a72

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/backend/commands/prepare.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ PrepareQuery(PrepareStmt *stmt, const char *queryString)
159159
nargs,
160160
NULL,
161161
NULL,
162-
0, /* default cursor options */
162+
CURSOR_OPT_PARALLEL_OK, /* allow parallel mode */
163163
true); /* fixed result */
164164

165165
/*

src/backend/tcop/postgres.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1381,7 +1381,7 @@ exec_parse_message(const char *query_string, /* string to execute */
13811381
numParams,
13821382
NULL,
13831383
NULL,
1384-
0, /* default cursor options */
1384+
CURSOR_OPT_PARALLEL_OK, /* allow parallel mode */
13851385
true); /* fixed result */
13861386

13871387
/* If we got a cancel signal during analysis, quit */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy