8000 Enable parallel SELECT for "INSERT INTO ... SELECT ...". · postgres/postgres@05c8482 · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"commit":{"oid":"05c8482f7f69a954fd65fce85f896e848fc48197","url":"/postgres/postgres/commit/05c8482f7f69a954fd65fce85f896e848fc48197","authoredDate":"2021-03-10T07:38:58.000+05:30","committedDate":"2021-03-10T07:38:58.000+05:30","shortMessage":null,"shortMessageMarkdown":"\u003cdiv\u003eEnable parallel SELECT for \"INSERT INTO ... SELECT ...\".\u003c/div\u003e","shortMessageMarkdownLink":null,"bodyMessageHtml":"Parallel SELECT can't be utilized for INSERT in the following cases:\n- INSERT statement uses the ON CONFLICT DO UPDATE clause\n- Target table has a parallel-unsafe: trigger, index expression or\n predicate, column default expression or check constraint\n- Target table has a parallel-unsafe domain constraint on any column\n- Target table is a partitioned table with a parallel-unsafe partition key\n expression or support function\n\nThe planner is updated to perform additional parallel-safety checks for\nthe cases listed above, for determining whether it is safe to run INSERT\nin parallel-mode with an underlying parallel SELECT. The planner will\nconsider using parallel SELECT for \"INSERT INTO ... SELECT ...\", provided\nnothing unsafe is found from the additional parallel-safety checks, or\nfrom the existing parallel-safety checks for SELECT.\n\nWhile checking parallel-safety, we need to check it for all the partitions\non the table which can be costly especially when we decide not to use a\nparallel plan. So, in a separate patch, we will introduce a GUC and or a\nreloption to enable/disable parallelism for Insert statements.\n\nPrior to entering parallel-mode for the execution of INSERT with parallel\nSELECT, a TransactionId is acquired and assigned to the current\ntransaction state. This is necessary to prevent the INSERT from attempting\nto assign the TransactionId whilst in parallel-mode, which is not allowed.\nThis approach has a disadvantage in that if the underlying SELECT does not\nreturn any rows, then the TransactionId is not used, however that\nshouldn't happen in practice in many cases.\n\nAuthor: Greg Nancarrow, Amit Langote, Amit Kapila\nReviewed-by: Amit Langote, Hou Zhijie, Takayuki Tsunakawa, Antonin Houska, Bharath Rupireddy, Dilip Kumar, Vignesh C, Zhihong Yu, Amit Kapila\nTested-by: Tang, Haiying\nDiscussion: \u003ca href=\"https://postgr.es/m/CAJcOf-cXnB5cnMKqWEp2E2z7Mvcd04iLVmV=qpFJrR3AcrTS3g@mail.gmail.com\" rel=\"nofollow\"\u003ehttps://postgr.es/m/CAJcOf-cXnB5cnMKqWEp2E2z7Mvcd04iLVmV=qpFJrR3AcrTS3g@mail.gmail.com\u003c/a\u003e\nDiscussion: \u003ca href=\"https://postgr.es/m/CAJcOf-fAdj=nDKMsRhQzndm-O13NY4dL6xGcEvdX5Xvbbi0V7g@mail.gmail.com\" rel=\"nofollow\"\u003ehttps://postgr.es/m/CAJcOf-fAdj=nDKMsRhQzndm-O13NY4dL6xGcEvdX5Xvbbi0V7g@mail.gmail.com\u003c/a\u003e","authors":[{"login":null,"displayName":"Amit Kapila","avatarUrl":"https://github.githubassets.com/images/gravatars/gravatar-user-420.png","isGitHub":false}],"committerAttribution":false,"committer":{"login":null,"displayName":"Amit Kapila","avatarUrl":"https://github.githubassets.com/images/gravatars/gravatar-user-420.png","isGitHub":false},"parents":["0ba71107efeeccde9158f47118f95043afdca0bb"],"globalRelayId":"MDY6Q29tbWl0OTI3NDQyOjA1Yzg0ODJmN2Y2OWE5NTRmZDY1ZmNlODVmODk2ZTg0OGZjNDgxOTc=","sha1":"0ba71107efeeccde9158f47118f95043afdca0bb","sha2":"05c8482f7f69a954fd65fce85f896e848fc48197"},"currentUser":null,"repo":{"id":927442,"defaultBranch":"master","name":"postgres","ownerLogin":"postgres","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2010-09-21T11:35:45.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/177543?v=4","public":true,"private":false,"isOrgOwned":true},"diffEntryData":[{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":145,"text":"@@ -146,7 +146,9 @@ EXPLAIN SELECT * FROM pgbench_accounts WHERE filler LIKE '%x%';","html":"@@ -146,7 +146,9 @@ EXPLAIN SELECT * FROM pgbench_accounts WHERE filler LIKE \u0026#39;%x%\u0026#39;;","displayNoNewLineWarning":false,"position":0,"left":145,"right":145},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":146,"text":" a CTE, no parallel plans for that query will be generated. As an","html":" a CTE, no parallel plans for that query will be generated. As an","displayNoNewLineWarning":false,"position":1,"left":146,"right":146},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":147,"text":" exception, the commands \u003cliteral\u003eCREATE TABLE ... AS\u003c/literal\u003e, \u003cliteral\u003eSELECT","html":" exception, the commands \u0026lt;literal\u0026gt;CREATE TABLE ... AS\u0026lt;/literal\u0026gt;, \u0026lt;literal\u0026gt;SELECT","displayNoNewLineWarning":false,"position":2,"left":147,"right":147},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":148,"text":" INTO\u003c/literal\u003e, and \u003cliteral\u003eCREATE MATERIALIZED VIEW\u003c/literal\u003e which create a new","html":" INTO\u0026lt;/literal\u0026gt;, and \u0026lt;literal\u0026gt;CREATE MATERIALIZED VIEW\u0026lt;/literal\u0026gt; which create a new","displayNoNewLineWarning":false,"position":3,"left":148,"right":148},{"stylingDirective":null,"type":"DELETION","blobLineNumber":149,"text":"- table and populate it can use a parallel plan.","html":"- table and populate it can use a parallel plan.","displayNoNewLineWarning":false,"position":4,"left":149,"right":148},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":149,"text":"+ table and populate it can use a parallel plan. Another exception is the command","html":"+ table and populate it can use a parallel plan. Another exception is the command","displayNoNewLineWarning":false,"position":5,"left":149,"right":149},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":150,"text":"+ \u003cliteral\u003eINSERT INTO ... SELECT ...\u003c/literal\u003e which can use a parallel plan for","html":"+ \u0026lt;literal\u0026gt;INSERT INTO ... SELECT ...\u0026lt;/literal\u0026gt; which can use a parallel plan for","displayNoNewLineWarning":false,"position":6,"left":149,"right":150},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":151,"text":"+ the underlying \u003cliteral\u003eSELECT\u003c/literal\u003e part of the query.","html":"+ the underlying \u0026lt;literal\u0026gt;SELECT\u0026lt;/literal\u0026gt; part of the query.","displayNoNewLineWarning":false,"position":7,"left":149,"right":151},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":152,"text":" \u003c/para\u003e","html":" \u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":8,"left":150,"right":152},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":153,"text":" \u003c/listitem\u003e","html":" \u0026lt;/listitem\u0026gt;","displayNoNewLineWarning":false,"position":9,"left":151,"right":153},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":154,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":10,"left":152,"right":154}],"diffNumber":0,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":584,"linesChanged":4,"newTreeEntry":{"lineCount":584,"path":"doc/src/sgml/parallel.sgml","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"doc/src/sgml/parallel.sgml","mode":100644},"linesAdded":3,"linesDeleted":1,"path":"doc/src/sgml/parallel.sgml","pathDigest":"03240797a077fc54437b5ff5e94be4f9c47d32a53a31274986f38f08f9d10c3a","status":"MODIFIED","truncatedReason":null,"oldOid":"0ba71107efeeccde9158f47118f95043afdca0bb","newOid":"05c8482f7f69a954fd65fce85f896e848fc48197","copilotChatReference":null,"deletedSha":"0ba71107efeeccde9158f47118f95043afdca0bb","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":1013,"text":"@@ -1014,6 +1014,32 @@ IsInParallelMode(void)","html":"@@ -1014,6 +1014,32 @@ IsInParallelMode(void)","displayNoNewLineWarning":false,"position":0,"left":1013,"right":1013},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1014,"text":" \treturn CurrentTransactionState-\u003eparallelModeLevel != 0;","html":" \t\u003cspan class=pl-k\u003ereturn\u003c/span\u003e \u003cspan class=pl-s1\u003eCurrentTransactionState\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eparallelModeLevel\u003c/span\u003e \u003cspan class=pl-c1\u003e!=\u003c/span\u003e \u003cspan class=pl-c1\u003e0\u003c/span\u003e;","displayNoNewLineWarning":false,"position":1,"left":1014,"right":1014},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1015,"text":" }","html":" }","displayNoNewLineWarning":false,"position":2,"left":1015,"right":1015},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1016,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":3,"left":1016,"right":1016},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1017,"text":"+/*","html":"+\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":4,"left":1016,"right":1017},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1018,"text":"+ *\tPrepareParallelModePlanExec","html":"+\u003cspan class=pl-c\u003e *\tPrepareParallelModePlanExec\u003c/span\u003e","displayNoNewLineWarning":false,"position":5,"left":1016,"right":1018},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1019,"text":"+ *","html":"+\u003cspan class=pl-c\u003e *\u003c/span\u003e","displayNoNewLineWarning":false,"position":6,"left":1016,"right":1019},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1020,"text":"+ * Prepare for entering parallel mode plan execution, based on command-type.","html":"+\u003cspan class=pl-c\u003e * Prepare for entering parallel mode plan execution, based on command-type.\u003c/span\u003e","displayNoNewLineWarning":false,"position":7,"left":1016,"right":1020},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1021,"text":"+ */","html":"+\u003cspan class=pl-c\u003e */\u003c/span\u003e","displayNoNewLineWarning":false,"position":8,"left":1016,"right":1021},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1022,"text":"+void","html":"+\u003cspan class=pl-smi\u003evoid\u003c/span\u003e","displayNoNewLineWarning":false,"position":9,"left":1016,"right":1022},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1023,"text":"+PrepareParallelModePlanExec(CmdType commandType)","html":"+\u003cspan class=pl-en\u003ePrepareParallelModePlanExec\u003c/span\u003e(\u003cspan class=pl-smi\u003eCmdType\u003c/span\u003e \u003cspan class=pl-s1\u003ecommandType\u003c/span\u003e)","displayNoNewLineWarning":false,"position":10,"left":1016,"right":1023},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1024,"text":"+{","html":"+{","displayNoNewLineWarning":false,"position":11,"left":1016,"right":1024},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1025,"text":"+\tif (IsModifySupportedInParallelMode(commandType))","html":"+\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003eIsModifySupportedInParallelMode\u003c/span\u003e(\u003cspan class=pl-s1\u003ecommandType\u003c/span\u003e))","displayNoNewLineWarning":false,"position":12,"left":1016,"right":1025},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1026,"text":"+\t{","html":"+\t{","displayNoNewLineWarning":false,"position":13,"left":1016,"right":1026},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1027,"text":"+\t\tAssert(!IsInParallelMode());","html":"+\t\t\u003cspan class=pl-en\u003eAssert\u003c/span\u003e(!\u003cspan class=pl-en\u003eIsInParallelMode\u003c/span\u003e());","displayNoNewLineWarning":false,"position":14,"left":1016,"right":1027},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1028,"text":"+","html":"+","displayNoNewLineWarning":false,"position":15,"left":1016,"right":1028},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1029,"text":"+\t\t/*","html":"+\t\t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":16,"left":1016,"right":1029},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1030,"text":"+\t\t * Prepare for entering parallel mode by assigning a TransactionId.","html":"+\u003cspan class=pl-c\u003e\t\t * Prepare for entering parallel mode by assigning a TransactionId.\u003c/span\u003e","displayNoNewLineWarning":false,"position":17,"left":1016,"right":1030},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1031,"text":"+\t\t * Failure to do this now would result in heap_insert() subsequently","html":"+\u003cspan class=pl-c\u003e\t\t * Failure to do this now would result in heap_insert() subsequently\u003c/span\u003e","displayNoNewLineWarning":false,"position":18,"left":1016,"right":1031},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1032,"text":"+\t\t * attempting to assign a TransactionId whilst in parallel-mode, which","html":"+\u003cspan class=pl-c\u003e\t\t * attempting to assign a TransactionId whilst in parallel-mode, which\u003c/span\u003e","displayNoNewLineWarning":false,"position":19,"left":1016,"right":1032},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1033,"text":"+\t\t * is not allowed.","html":"+\u003cspan class=pl-c\u003e\t\t * is not allowed.\u003c/span\u003e","displayNoNewLineWarning":false,"position":20,"left":1016,"right":1033},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1034,"text":"+\t\t *","html":"+\u003cspan class=pl-c\u003e\t\t *\u003c/span\u003e","displayNoNewLineWarning":false,"position":21,"left":1016,"right":1034},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1035,"text":"+\t\t * This approach has a disadvantage in that if the underlying SELECT","html":"+\u003cspan class=pl-c\u003e\t\t * This approach has a disadvantage in that if the underlying SELECT\u003c/span\u003e","displayNoNewLineWarning":false,"position":22,"left":1016,"right":1035},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1036,"text":"+\t\t * does not return any rows, then the TransactionId is not used,","html":"+\u003cspan class=pl-c\u003e\t\t * does not return any rows, then the TransactionId is not used,\u003c/span\u003e","displayNoNewLineWarning":false,"position":23,"left":1016,"right":1036},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1037,"text":"+\t\t * however that shouldn't happen in practice in many cases.","html":"+\u003cspan class=pl-c\u003e\t\t * however that shouldn\u0026#39;t happen in practice in many cases.\u003c/span\u003e","displayNoNewLineWarning":false,"position":24,"left":1016,"right":1037},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1038,"text":"+\t\t */","html":"+\u003cspan class=pl-c\u003e\t\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":25,"left":1016,"right":1038},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1039,"text":"+\t\t(void) GetCurrentTransactionId();","html":"+\t\t(\u003cspan class=pl-smi\u003evoid\u003c/span\u003e) \u003cspan class=pl-en\u003eGetCurrentTransactionId\u003c/span\u003e();","displayNoNewLineWarning":false,"position":26,"left":1016,"right":1039},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1040,"text":"+\t}","html":"+\t}","displayNoNewLineWarning":false,"position":27,"left":1016,"right":1040},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1041,"text":"+}","html":"+}","displayNoNewLineWarning":false,"position":28,"left":1016,"right":1041},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1042,"text":"+","html":"+","displayNoNewLineWarning":false,"position":29,"left":1016,"right":1042},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1043,"text":" /*","html":" \u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":30,"left":1017,"right":1043},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1044,"text":" *\tCommandCounterIncrement","html":" \u003cspan class=pl-c\u003e *\tCommandCounterIncrement\u003c/span\u003e","displayNoNewLineWarning":false,"position":31,"left":1018,"right":1044},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1045,"text":" */","html":" \u003cspan class=pl-c\u003e */\u003c/span\u003e","displayNoNewLineWarning":false,"position":32,"left":1019,"right":1045}],"diffNumber":1,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":6146,"linesChanged":26,"newTreeEntry":{"lineCount":6146,"path":"src/backend/access/transam/xact.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/backend/access/transam/xact.c","mode":100644},"linesAdded":26,"linesDeleted":0,"path":"src/backend/access/transam/xact.c","pathDigest":"9dc8f7d8c41c84be9fe076d88007d03e96587b86151d632ac89eb7025bb54ab4","status":"MODIFIED","truncatedReason":null,"oldOid":"0ba71107efeeccde9158f47118f95043afdca0bb","newOid":"05c8482f7f69a954fd65fce85f896e848fc48197","copilotChatReference":null,"deletedSha":"0ba71107efeeccde9158f47118f95043afdca0bb","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":1511,"text":"@@ -1512,7 +1512,10 @@ ExecutePlan(EState *estate,","html":"@@ -1512,7 +1512,10 @@ ExecutePlan(EState *estate,","displayNoNewLineWarning":false,"position":0,"left":1511,"right":1511},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1512,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":1,"left":1512,"right":1512},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1513,"text":" \testate-\u003ees_use_parallel_mode = use_parallel_mode;","html":" \t\u003cspan class=pl-s1\u003eestate\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003ees_use_parallel_mode\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003euse_parallel_mode\u003c/span\u003e;","displayNoNewLineWarning":false,"position":2,"left":1513,"right":1513},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1514,"text":" \tif (use_parallel_mode)","html":" \t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-s1\u003euse_parallel_mode\u003c/span\u003e)","displayNoNewLineWarning":false,"position":3,"left":1514,"right":1514},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1515,"text":"+\t{","html":"+\t{","displayNoNewLineWarning":false,"position":4,"left":1514,"right":1515},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1516,"text":"+\t\tPrepareParallelModePlanExec(estate-\u003ees_plannedstmt-\u003ecommandType);","html":"+\t\t\u003cspan class=pl-en\u003ePrepareParallelModePlanExec\u003c/span\u003e(\u003cspan class=pl-s1\u003eestate\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003ees_plannedstmt\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003ecommandType\u003c/span\u003e);","displayNoNewLineWarning":false,"position":5,"left":1514,"right":1516},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1517,"text":" \t\tEnterParallelMode();","html":" \t\t\u003cspan class=pl-en\u003eEnterParallelMode\u003c/span\u003e();","displayNoNewLineWarning":false,"position":6,"left":1515,"right":1517},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1518,"text":"+\t}","html":"+\t}","displayNoNewLineWarning":false,"position":7,"left":1515,"right":1518},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1519,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":8,"left":1516,"right":1519},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1520,"text":" \t/*","html":" \t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":9,"left":1517,"right":1520},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1521,"text":" \t * Loop until we've processed the proper number of tuples from the plan.","html":" \u003cspan class=pl-c\u003e\t * Loop until we\u0026#39;ve processed the proper number of tuples from the plan.\u003c/span\u003e","displayNoNewLineWarning":false,"position":10,"left":1518,"right":1521}],"diffNumber":2,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":2856,"linesChanged":3,"newTreeEntry":{"lineCount":2856,"path":"src/backend/executor/execMain.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/backend/executor/execMain.c","mode":100644},"linesAdded":3,"linesDeleted":0,"path":"src/backend/executor/execMain.c","pathDigest":"ed8e9724b668cf25323e7d12c3354102d66936be19eae302d7ca599988e5bfc8","status":"MODIFIED","truncatedReason":null,"oldOid":"0ba71107efeeccde9158f47118f95043afdca0bb","newOid":"05c8482f7f69a954fd65fce85f896e848fc48197","copilotChatReference":null,"deletedSha":"0ba71107efeeccde9158f47118f95043afdca0bb","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":95,"text":"@@ -96,6 +96,7 @@ _copyPlannedStmt(const PlannedStmt *from)","html":"@@ -96,6 +96,7 @@ _copyPlannedStmt(const PlannedStmt *from)","displayNoNewLineWarning":false,"position":0,"left":95,"right":95},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":96,"text":" \tCOPY_BITMAPSET_FIELD(rewindPlanIDs);","html":" \t\u003cspan class=pl-en\u003eCOPY_BITMAPSET_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003erewindPlanIDs\u003c/span\u003e);","displayNoNewLineWarning":false,"position":1,"left":96,"right":96},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":97,"text":" \tCOPY_NODE_FIELD(rowMarks);","html":" \t\u003cspan class=pl-en\u003eCOPY_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003erowMarks\u003c/span\u003e);","displayNoNewLineWarning":false,"position":2,"left":97,"right":97},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":98,"text":" \tCOPY_NODE_FIELD(relationOids);","html":" \t\u003cspan class=pl-en\u003eCOPY_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003erelationOids\u003c/span\u003e);","displayNoNewLineWarning":false,"position":3,"left":98,"right":98},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":99,"text":"+\tCOPY_NODE_FIELD(partitionOids);","html":"+\t\u003cspan class=pl-en\u003eCOPY_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003epartitionOids\u003c/span\u003e);","displayNoNewLineWarning":false,"position":4,"left":98,"right":99},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":100,"text":" \tCOPY_NODE_FIELD(invalItems);","html":" \t\u003cspan class=pl-en\u003eCOPY_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003einvalItems\u003c/span\u003e);","displayNoNewLineWarning":false,"position":5,"left":99,"right":100},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":101,"text":" \tCOPY_NODE_FIELD(paramExecTypes);","html":" \t\u003cspan class=pl-en\u003eCOPY_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003eparamExecTypes\u003c/span\u003e);","displayNoNewLineWarning":false,"position":6,"left":100,"right":101},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":102,"text":" \tCOPY_NODE_FIELD(utilityStmt);","html":" \t\u003cspan class=pl-en\u003eCOPY_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003eutilityStmt\u003c/span\u003e);","displayNoNewLineWarning":false,"position":7,"left":101,"right":102}],"diffNumber":3,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":5798,"linesChanged":1,"newTreeEntry":{"lineCount":5798,"path":"src/backend/nodes/copyfuncs.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/backend/nodes/copyfuncs.c","mode":100644},"linesAdded":1,"linesDeleted":0,"path":"src/backend/nodes/copyfuncs.c","pathDigest":"edd4dbac57e0cc9bcfc307c818e942874ce18953706a8e90ac7ec5e375c3924b","status":"MODIFIED","truncatedReason":null,"oldOid":"0ba71107efeeccde9158f47118f95043afdca0bb","newOid":"05c8482f7f69a954fd65fce85f896e848fc48197","copilotChatReference":null,"deletedSha":"0ba71107efeeccde9158f47118f95043afdca0bb","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":313,"text":"@@ -314,6 +314,7 @@ _outPlannedStmt(StringInfo str, const PlannedStmt *node)","html":"@@ -314,6 +314,7 @@ _outPlannedStmt(StringInfo str, const PlannedStmt *node)","displayNoNewLineWarning":false,"position":0,"left":313,"right":313},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":314,"text":" \tWRITE_BITMAPSET_FIELD(rewindPlanIDs);","html":" \t\u003cspan class=pl-en\u003eWRITE_BITMAPSET_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003erewindPlanIDs\u003c/span\u003e);","displayNoNewLineWarning":false,"position":1,"left":314,"right":314},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":315,"text":" \tWRITE_NODE_FIELD(rowMarks);","html":" \t\u003cspan class=pl-en\u003eWRITE_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003erowMarks\u003c/span\u003e);","displayNoNewLineWarning":false,"position":2,"left":315,"right":315},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":316,"text":" \tWRITE_NODE_FIELD(relationOids);","html":" \t\u003cspan class=pl-en\u003eWRITE_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003erelationOids\u003c/span\u003e);","displayNoNewLineWarning":false,"position":3,"left":316,"right":316},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":317,"text":"+\tWRITE_NODE_FIELD(partitionOids);","html":"+\t\u003cspan class=pl-en\u003eWRITE_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003epartitionOids\u003c/span\u003e);","displayNoNewLineWarning":false,"position":4,"left":316,"right":317},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":318,"text":" \tWRITE_NODE_FIELD(invalItems);","html":" \t\u003cspan class=pl-en\u003eWRITE_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003einvalItems\u003c/span\u003e);","displayNoNewLineWarning":false,"position":5,"left":317,"right":318},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":319,"text":" \tWRITE_NODE_FIELD(paramExecTypes);","html":" \t\u003cspan class=pl-en\u003eWRITE_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003eparamExecTypes\u003c/span\u003e);","displayNoNewLineWarning":false,"position":6,"left":318,"right":319},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":320,"text":" \tWRITE_NODE_FIELD(utilityStmt);","html":" \t\u003cspan class=pl-en\u003eWRITE_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003eutilityStmt\u003c/span\u003e);","displayNoNewLineWarning":false,"position":7,"left":319,"right":320},{"stylingDirective":null,"type":"HUNK","blobLineNumber":2221,"text":"@@ -2221,6 +2222,7 @@ _outPlannerGlobal(StringInfo str, const PlannerGlobal *node)","html":"@@ -2221,6 +2222,7 @@ _outPlannerGlobal(StringInfo str, const PlannerGlobal *node)","displayNoNewLineWarning":false,"position":8,"left":2220,"right":2221},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2222,"text":" \tWRITE_NODE_FIELD(resultRelations);","html":" \t\u003cspan class=pl-en\u003eWRITE_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003eresultRelations\u003c/span\u003e);","displayNoNewLineWarning":false,"position":9,"left":2221,"right":2222},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2223,"text":" \tWRITE_NODE_FIELD(appendRelations);","html":" \t\u003cspan class=pl-en\u003eWRITE_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003eappendRelations\u003c/span\u003e);","displayNoNewLineWarning":false,"position":10,"left":2222,"right":2223},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2224,"text":" \tWRITE_NODE_FIELD(relationOids);","html":" \t\u003cspan class=pl-en\u003eWRITE_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003erelationOids\u003c/span\u003e);","displayNoNewLineWarning":false,"position":11,"left":2223,"right":2224},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2225,"text":"+\tWRITE_NODE_FIELD(partitionOids);","html":"+\t\u003cspan class=pl-en\u003eWRITE_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003epartitionOids\u003c/span\u003e);","displayNoNewLineWarning":false,"position":12,"left":2223,"right":2225},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2226,"text":" \tWRITE_NODE_FIELD(invalItems);","html":" \t\u003cspan class=pl-en\u003eWRITE_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003einvalItems\u003c/span\u003e);","displayNoNewLineWarning":false,"position":13,"left":2224,"right":2226},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2227,"text":" \tWRITE_NODE_FIELD(paramExecTypes);","html":" \t\u003cspan class=pl-en\u003eWRITE_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003eparamExecTypes\u003c/span\u003e);","displayNoNewLineWarning":false,"position":14,"left":2225,"right":2227},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":2228,"text":" \tWRITE_UINT_FIELD(lastPHId);","html":" \t\u003cspan class=pl-en\u003eWRITE_UINT_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003elastPHId\u003c/span\u003e);","displayNoNewLineWarning":false,"position":15,"left":2226,"right":2228}],"diffNumber":4,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":4463,"linesChanged":2,"newTreeEntry":{"lineCount":4463,"path":"src/backend/nodes/outfuncs.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/backend/nodes/outfuncs.c","mode":100644},"linesAdded":2,"linesDeleted":0,"path":"src/backend/nodes/outfuncs.c","pathDigest":"1c2debd28a0ec3f2dafebe2d0688c3fca898d8fb7309e5c514a420403659d5a8","status":"MODIFIED","truncatedReason":null,"oldOid":"0ba71107efeeccde9158f47118f95043afdca0bb","newOid":"05c8482f7f69a954fd65fce85f896e848fc48197","copilotChatReference":null,"deletedSha":"0ba71107efeeccde9158f47118f95043afdca0bb","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":1589,"text":"@@ -1590,6 +1590,7 @@ _readPlannedStmt(void)","html":"@@ -1590,6 +1590,7 @@ _readPlannedStmt(void)","displayNoNewLineWarning":false,"position":0,"left":1589,"right":1589},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1590,"text":" \tREAD_BITMAPSET_FIELD(rewindPlanIDs);","html":" \t\u003cspan class=pl-en\u003eREAD_BITMAPSET_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003erewindPlanIDs\u003c/span\u003e);","displayNoNewLineWarning":false,"position":1,"left":1590,"right":1590},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1591,"text":" \tREAD_NODE_FIELD(rowMarks);","html":" \t\u003cspan class=pl-en\u003eREAD_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003erowMarks\u003c/span\u003e);","displayNoNewLineWarning":false,"position":2,"left":1591,"right":1591},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1592,"text":" \tREAD_NODE_FIELD(relationOids);","html":" \t\u003cspan class=pl-en\u003eREAD_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003erelationOids\u003c/span\u003e);","displayNoNewLineWarning":false,"position":3,"left":1592,"right":1592},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1593,"text":"+\tREAD_NODE_FIELD(partitionOids);","html":"+\t\u003cspan class=pl-en\u003eREAD_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003epartitionOids\u003c/span\u003e);","displayNoNewLineWarning":false,"position":4,"left":1592,"right":1593},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1594,"text":" \tREAD_NODE_FIELD(invalItems);","html":" \t\u003cspan class=pl-en\u003eREAD_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003einvalItems\u003c/span\u003e);","displayNoNewLineWarning":false,"position":5,"left":1593,"right":1594},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1595,"text":" \tREAD_NODE_FIELD(paramExecTypes);","html":" \t\u003cspan class=pl-en\u003eREAD_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003eparamExecTypes\u003c/span\u003e);","displayNoNewLineWarning":false,"position":6,"left":1594,"right":1595},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1596,"text":" \ 8000 tREAD_NODE_FIELD(utilityStmt);","html":" \t\u003cspan class=pl-en\u003eREAD_NODE_FIELD\u003c/span\u003e(\u003cspan class=pl-s1\u003eutilityStmt\u003c/span\u003e);","displayNoNewLineWarning":false,"position":7,"left":1595,"right":1596}],"diffNumber":5,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":3111,"linesChanged":1,"newTreeEntry":{"lineCount":3111,"path":"src/backend/nodes/readfuncs.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/backend/nodes/readfuncs.c","mode":100644},"linesAdded":1,"linesDeleted":0,"path":"src/backend/nodes/readfuncs.c","pathDigest":"24b9d59c315b943222c4d0a70fde067132570f75cf19247deb6b6d58ba6892ab","status":"MODIFIED","truncatedReason":null,"oldOid":"0ba71107efeeccde9158f47118f95043afdca0bb","newOid":"05c8482f7f69a954fd65fce85f896e848fc48197","copilotChatReference":null,"deletedSha":"0ba71107efeeccde9158f47118f95043afdca0bb","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":304,"text":"@@ -305,6 +305,7 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,","html":"@@ -305,6 +305,7 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,","displayNoNewLineWarning":false,"position":0,"left":304,"right":304},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":305,"text":" \tglob-\u003eresultRelations = NIL;","html":" \t\u003cspan class=pl-s1\u003eglob\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eresultRelations\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-c1\u003eNIL\u003c/span\u003e;","displayNoNewLineWarning":false,"position":1,"left":305,"right":305},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":306,"text":" \tglob-\u003eappendRelations = NIL;","html":" \t\u003cspan class=pl-s1\u003eglob\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eappendRelations\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-c1\u003eNIL\u003c/span\u003e;","displayNoNewLineWarning":false,"position":2,"left":306,"right":306},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":307,"text":" \tglob-\u003erelationOids = NIL;","html":" \t\u003cspan class=pl-s1\u003eglob\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003erelationOids\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-c1\u003eNIL\u003c/span\u003e;","displayNoNewLineWarning":false,"position":3,"left":307,"right":307},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":308,"text":"+\tglob-\u003epartitionOids = NIL;","html":"+\t\u003cspan class=pl-s1\u003eglob\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003epartitionOids\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-c1\u003eNIL\u003c/span\u003e;","displayNoNewLineWarning":false,"position":4,"left":307,"right":308},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":309,"text":" \tglob-\u003einvalItems = NIL;","html":" \t\u003cspan class=pl-s1\u003eglob\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003einvalItems\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-c1\u003eNIL\u003c/span\u003e;","displayNoNewLineWarning":false,"position":5,"left":308,"right":309},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":310,"text":" \tglob-\u003eparamExecTypes = NIL;","html":" \t\u003cspan class=pl-s1\u003eglob\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eparamExecTypes\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-c1\u003eNIL\u003c/span\u003e;","displayNoNewLineWarning":false,"position":6,"left":309,"right":310},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":311,"text":" \tglob-\u003elastPHId = 0;","html":" \t\u003cspan class=pl-s1\u003eglob\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003elastPHId\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-c1\u003e0\u003c/span\u003e;","displayNoNewLineWarning":false,"position":7,"left":310,"right":311},{"stylingDirective":null,"type":"HUNK","blobLineNumber":316,"text":"@@ -316,16 +317,16 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,","html":"@@ -316,16 +317,16 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,","displayNoNewLineWarning":false,"position":8,"left":315,"right":316},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":317,"text":" \t/*","html":" \t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":9,"left":316,"right":317},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":318,"text":" \t * Assess whether it's feasible to use parallel mode for this query. We","html":" \u003cspan class=pl-c\u003e\t * Assess whether it\u0026#39;s feasible to use parallel mode for this query. We\u003c/span\u003e","displayNoNewLineWarning":false,"position":10,"left":317,"right":318},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":319,"text":" \t * can't do this in a standalone backend, or if the command will try to","html":" \u003cspan class=pl-c\u003e\t * can\u0026#39;t do this in a standalone backend, or if the command will try to\u003c/span\u003e","displayNoNewLineWarning":false,"position":11,"left":318,"right":319},{"stylingDirective":null,"type":"DELETION","blobLineNumber":319,"text":"-\t * modify any data, or if this is a cursor operation, or if GUCs are set","html":"-\u003cspan class=\"pl-c\"\u003e\t * modify any data, or if this is a cursor operation,\u003cspan class=\"x x-first x-last\"\u003e or if GUCs are set\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":12,"left":319,"right":319},{"stylingDirective":null,"type":"DELETION","blobLineNumber":320,"text":"-\t * to values that don't permit parallelism, or if parallel-unsafe","html":"-\u003cspan class=\"pl-c\"\u003e\t * to values that don't permit parallelism, or if\u003cspan class=\"x x-first x-last\"\u003e parallel-unsafe\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":13,"left":320,"right":319},{"stylingDirective":null,"type":"DELETION","blobLineNumber":321,"text":"-\t * functions are present in the query tree.","html":"-\u003cspan class=\"pl-c\"\u003e\t * functions are present in the query tree.\u003c/span\u003e","displayNoNewLineWarning":false,"position":14,"left":321,"right":319},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":320,"text":"+\t * modify any data (except for Insert), or if this is a cursor operation,","html":"+\u003cspan class=\"pl-c\"\u003e\t * modify any data\u003cspan class=\"x x-first x-last\"\u003e (except for Insert)\u003c/span\u003e, or if this is a cursor operation,\u003c/span\u003e","displayNoNewLineWarning":false,"position":15,"left":321,"right":320},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":321,"text":"+\t * or if GUCs are set to values that don't permit parallelism, or if","html":"+\u003cspan class=\"pl-c\"\u003e\t * \u003cspan class=\"x x-first x-last\"\u003eor if GUCs are set \u003c/span\u003eto values that don't permit parallelism, or if\u003c/span\u003e","displayNoNewLineWarning":false,"position":16,"left":321,"right":321},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":322,"text":"+\t * parallel-unsafe functions are present in the query tree.","html":"+\u003cspan class=\"pl-c\"\u003e\t * \u003cspan class=\"x x-first x-last\"\u003eparallel-unsafe \u003c/span\u003efunctions are present in the query tree.\u003c/span\u003e","displayNoNewLineWarning":false,"position":17,"left":321,"right":322},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":323,"text":" \t *","html":" \u003cspan class=pl-c\u003e\t *\u003c/span\u003e","displayNoNewLineWarning":false,"position":18,"left":322,"right":323},{"stylingDirective":null,"type":"DELETION","blobLineNumber":323,"text":"-\t * (Note that we do allow CREATE TABLE AS, SELECT INTO, and CREATE","html":"-\u003cspan class=\"pl-c\"\u003e\t * (Note that we do allow CREATE TABLE AS, \u003cspan class=\"x x-first x-last\"\u003eSELECT\u003c/span\u003e INTO\u003cspan class=\"x x-first x-last\"\u003e, and CREATE\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":19,"left":323,"right":323},{"stylingDirective":null,"type":"DELETION","blobLineNumber":324,"text":"-\t * MATERIALIZED VIEW to use parallel plans, but as of now, only the leader","html":"-\u003cspan class=\"pl-c\"\u003e\t * MATERIALIZED VIEW to use parallel plans\u003cspan class=\"x x-first x-last\"\u003e, but as of now, only the leader\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":20,"left":324,"right":323},{"stylingDirective":null,"type":"DELETION","blobLineNumber":325,"text":"-\t * backend writes into a completely new table. In the future, we can","html":"-\u003cspan class=\"pl-c\"\u003e\t * backend writes into a completely new table. \u003cspan class=\"x x-first x-last\"\u003e In the future, we can\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":21,"left":325,"right":323},{"stylingDirective":null,"type":"DELETION","blobLineNumber":326,"text":"-\t * extend it to allow workers to write into the table. However, to allow","html":"-\u003cspan class=\"pl-c\"\u003e\t * extend it to allow workers to write into the table.\u003cspan class=\"x x-first x-last\"\u003e However, to allow\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":22,"left":326,"right":323},{"stylingDirective":null,"type":"DELETION","blobLineNumber":327,"text":"-\t * parallel updates and deletes, we have to solve other problems,","html":"-\u003cspan class=\"pl-c\"\u003e\t * parallel updates and deletes, we have to solve other\u003cspan class=\"x x-first x-last\"\u003e problems,\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":23,"left":327,"right":323},{"stylingDirective":null,"type":"DELETION","blobLineNumber":328,"text":"-\t * especially around combo CIDs.)","html":"-\u003cspan class=\"pl-c\"\u003e\t * especially around combo CIDs.)\u003c/span\u003e","displayNoNewLineWarning":false,"position":24,"left":328,"right":323},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":324,"text":"+\t * (Note that we do allow CREATE TABLE AS, INSERT INTO...SELECT, SELECT","html":"+\u003cspan class=\"pl-c\"\u003e\t * (Note that we do allow CREATE TABLE AS, \u003cspan class=\"x x-first x-last\"\u003eINSERT\u003c/span\u003e INTO\u003cspan class=\"x x-first x-last\"\u003e...SELECT, SELECT\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":25,"left":328,"right":324},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":325,"text":"+\t * INTO, and CREATE MATERIALIZED VIEW to use parallel plans. However, as","html":"+\u003cspan class=\"pl-c\"\u003e\t * \u003cspan class=\"x x-first x-last\"\u003eINTO, and CREATE \u003c/span\u003eMATERIALIZED VIEW to use parallel plans\u003cspan class=\"x x-first x-last\"\u003e. However, as\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":26,"left":328,"right":325},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":326,"text":"+\t * of now, only the leader backend writes into a completely new table. In","html":"+\u003cspan class=\"pl-c\"\u003e\t * \u003cspan class=\"x x-first x-last\"\u003eof now, only the leader \u003c/span\u003ebackend writes into a completely new table. \u003cspan class=\"x x-first x-last\"\u003eIn\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":27,"left":328,"right":326},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":327,"text":"+\t * the future, we can extend it to allow workers to write into the table.","html":"+\u003cspan class=\"pl-c\"\u003e\t * \u003cspan class=\"x x-first x-last\"\u003ethe future, we can \u003c/span\u003eextend it to allow workers to write into the table.\u003c/span\u003e","displayNoNewLineWarning":false,"position":28,"left":328,"right":327},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":328,"text":"+\t * However, to allow parallel updates and deletes, we have to solve other","html":"+\u003cspan class=\"pl-c\"\u003e\t * \u003cspan class=\"x x-first x-last\"\u003eHowever, to allow \u003c/span\u003eparallel updates and deletes, we have to solve other\u003c/span\u003e","displayNoNewLineWarning":false,"position":29,"left":328,"right":328},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":329,"text":"+\t * problems, especially around combo CIDs.)","html":"+\u003cspan class=\"pl-c\"\u003e\t * \u003cspan class=\"x x-first x-last\"\u003eproblems, \u003c/span\u003eespecially around combo CIDs.)\u003c/span\u003e","displayNoNewLineWarning":false,"position":30,"left":328,"right":329},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":330,"text":" \t *","html":" \u003cspan class=pl-c\u003e\t *\u003c/span\u003e","displayNoNewLineWarning":false,"position":31,"left":329,"right":330},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":331,"text":" \t * For now, we don't try to use parallel mode if we're running inside a","html":" \u003cspan class=pl-c\u003e\t * For now, we don\u0026#39;t try to use parallel mode if we\u0026#39;re running inside a\u003c/span\u003e","displayNoNewLineWarning":false,"position":32,"left":330,"right":331},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":332,"text":" \t * parallel worker. We might eventually be able to relax this","html":" \u003cspan class=pl-c\u003e\t * parallel worker. We might eventually be able to relax this\u003c/span\u003e","displayNoNewLineWarning":false,"position":33,"left":331,"right":332},{"stylingDirective":null,"type":"HUNK","blobLineNumber":334,"text":"@@ -334,13 +335,14 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,","html":"@@ -334,13 +335,14 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,","displayNoNewLineWarning":false,"position":34,"left":333,"right":334},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":335,"text":" \t */","html":" \u003cspan class=pl-c\u003e\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":35,"left":334,"right":335},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":336,"text":" \tif ((cursorOptions \u0026 CURSOR_OPT_PARALLEL_OK) != 0 \u0026\u0026","html":" \t\u003cspan class=pl-k\u003eif\u003c/span\u003e ((\u003cspan class=pl-s1\u003ecursorOptions\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026amp;\u003c/span\u003e \u003cspan class=pl-c1\u003eCURSOR_OPT_PARALLEL_OK\u003c/span\u003e) \u003cspan class=pl-c1\u003e!=\u003c/span\u003e \u003cspan class=pl-c1\u003e0\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":36,"left":335,"right":336},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":337,"text":" \t\tIsUnderPostmaster \u0026\u0026","html":" \t\t\u003cspan class=pl-s1\u003eIsUnderPostmaster\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":37,"left":336,"right":337},{"stylingDirective":null,"type":"DELETION","blobLineNumber":337,"text":"-\t\tparse-\u003ecommandType == CMD_SELECT \u0026\u0026","html":"-\t\t\u003cspan class=pl-s1\u003eparse\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003ecommandType\u003c/span\u003e \u003cspan class=pl-c1\u003e==\u003c/span\u003e \u003cspan class=pl-c1\u003eCMD_SELECT\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":38,"left":337,"right":337},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":338,"text":"+\t\t(parse-\u003ecommandType == CMD_SELECT ||","html":"+\t\t(\u003cspan class=pl-s1\u003eparse\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003ecommandType\u003c/span\u003e \u003cspan class=pl-c1\u003e==\u003c/span\u003e \u003cspan class=pl-c1\u003eCMD_SELECT\u003c/span\u003e \u003cspan class=pl-c1\u003e||\u003c/span\u003e","displayNoNewLineWarning":false,"position":39,"left":337,"right":338},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":339,"text":"+\t\t is_parallel_allowed_for_modify(parse)) \u0026\u0026","html":"+\t\t \u003cspan class=pl-en\u003eis_parallel_allowed_for_modify\u003c/span\u003e(\u003cspan class=pl-s1\u003eparse\u003c/span\u003e)) \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":40,"left":337,"right":339},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":340,"text":" \t\t!parse-\u003ehasModifyingCTE \u0026\u0026","html":" \t\t!\u003cspan class=pl-s1\u003eparse\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003ehasModifyingCTE\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":41,"left":338,"right":340},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":341,"text":" \t\tmax_parallel_workers_per_gather \u003e 0 \u0026\u0026","html":" \t\t\u003cspan class=pl-s1\u003emax_parallel_workers_per_gather\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026gt;\u003c/span\u003e \u003cspan class=pl-c1\u003e0\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":42,"left":339,"right":341},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":342,"text":" \t\t!IsParallelWorker())","html":" \t\t!\u003cspan class=pl-en\u003eIsParallelWorker\u003c/span\u003e())","displayNoNewLineWarning":false,"position":43,"left":340,"right":342},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":343,"text":" \t{","html":" \t{","displayNoNewLineWarning":false,"position":44,"left":341,"right":343},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":344,"text":" \t\t/* all the cheap tests pass, so scan the query tree */","html":" \t\t\u003cspan class=pl-c\u003e/* all the cheap tests pass, so scan the query tree */\u003c/span\u003e","displayNoNewLineWarning":false,"position":45,"left":342,"right":344},{"stylingDirective":null,"type":"DELETION","blobLineNumber":343,"text":"-\t\tglob-\u003emaxParallelHazard = max_parallel_hazard(parse);","html":"-\t\t\u003cspan class=\"pl-s1\"\u003eglob\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003emaxParallelHazard\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emax_parallel_hazard\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eparse\u003c/span\u003e);","displayNoNewLineWarning":false,"position":46,"left":343,"right":344},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":345,"text":"+\t\tglob-\u003emaxParallelHazard = max_parallel_hazard(parse, glob);","html":"+\t\t\u003cspan class=\"pl-s1\"\u003eglob\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003emaxParallelHazard\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emax_parallel_hazard\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eparse\u003c/span\u003e\u003cspan class=\"x x-first\"\u003e, \u003c/span\u003e\u003cspan class=\"pl-s1 x x-last\"\u003eglob\u003c/span\u003e);","displayNoNewLineWarning":false,"position":47,"left":343,"right":345},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":346,"text":" \t\tglob-\u003eparallelModeOK = (glob-\u003emaxParallelHazard != PROPARALLEL_UNSAFE);","html":" \t\t\u003cspan class=pl-s1\u003eglob\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eparallelModeOK\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e (\u003cspan class=pl-s1\u003eglob\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003emaxParallelHazard\u003c/span\u003e \u003cspan class=pl-c1\u003e!=\u003c/span\u003e \u003cspan class=pl-c1\u003ePROPARALLEL_UNSAFE\u003c/span\u003e);","displayNoNewLineWarning":false,"position":48,"left":344,"right":346},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":347,"text":" \t}","html":" \t}","displayNoNewLineWarning":false,"position":49,"left":345,"right":347},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":348,"text":" \telse","html":" \t\u003cspan class=pl-k\u003eelse\u003c/span\u003e","displayNoNewLineWarning":false,"position":50,"left":346,"right":348},{"stylingDirective":null,"type":"HUNK","blobLineNumber":522,"text":"@@ -521,6 +523,19 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,","html":"@@ -521,6 +523,19 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,","displayNoNewLineWarning":false,"position":51,"left":520,"right":522},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":523,"text":" \tresult-\u003erewindPlanIDs = glob-\u003erewindPlanIDs;","html":" \t\u003cspan class=pl-s1\u003eresult\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003erewindPlanIDs\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003eglob\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003erewindPlanIDs\u003c/span\u003e;","displayNoNewLineWarning":false,"position":52,"left":521,"right":523},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":524,"text":" \tresult-\u003erowMarks = glob-\u003efinalrowmarks;","html":" \t\u003cspan class=pl-s1\u003eresult\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003erowMarks\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003eglob\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003efinalrowmarks\u003c/span\u003e;","displayNoNewLineWarning":false,"position":53,"left":522,"right":524},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":525,"text":" \tresult-\u003erelationOids = glob-\u003erelationOids;","html":" \t\u003cspan class=pl-s1\u003eresult\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003erelationOids\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003eglob\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003erelationOids\u003c/span\u003e;","displayNoNewLineWarning":false,"position":54,"left":523,"right":525},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":526,"text":"+","html":"+","displayNoNewLineWarning":false,"position":55,"left":523,"right":526},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":527,"text":"+\t/*","html":"+\t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":56,"left":523,"right":527},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":528,"text":"+\t * Register the Oids of parallel-safety-checked partitions as plan","html":"+\u003cspan class=pl-c\u003e\t * Register the Oids of parallel-safety-checked partitions as plan\u003c/span\u003e","displayNoNewLineWarning":false,"position":57,"left":523,"right":528},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":529,"text":"+\t * dependencies. This is only really needed in the case of a parallel plan","html":"+\u003cspan class=pl-c\u003e\t * dependencies. This is only really needed in the case of a parallel plan\u003c/span\u003e","displayNoNewLineWarning":false,"position":58,"left":523,"right":529},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":530,"text":"+\t * so that if parallel-unsafe properties are subsequently defined on the","html":"+\u003cspan class=pl-c\u003e\t * so that if parallel-unsafe properties are subsequently defined on the\u003c/span\u003e","displayNoNewLineWarning":false,"position":59,"left":523,"right":530},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":531,"text":"+\t * partitions, the cached parallel plan will be invalidated, and a","html":"+\u003cspan class=pl-c\u003e\t * partitions, the cached parallel plan will be invalidated, and a\u003c/span\u003e","displayNoNewLineWarning":false,"position":60,"left":523,"right":531},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":532,"text":"+\t * non-parallel plan will be generated.","html":"+\u003cspan class=pl-c\u003e\t * non-parallel plan will be generated.\u003c/span\u003e","displayNoNewLineWarning":false,"position":61,"left":523,"right":532},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":533,"text":"+\t *","html":"+\u003cspan class=pl-c\u003e\t *\u003c/span\u003e","displayNoNewLineWarning":false,"position":62,"left":523,"right":533},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":534,"text":"+\t * We also use this list to acquire locks on partitions before executing","html":"+\u003cspan class=pl-c\u003e\t * We also use this list to acquire locks on partitions before executing\u003c/span\u003e","displayNoNewLineWarning":false,"position":63,"left":523,"right":534},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":535,"text":"+\t * cached plan. See AcquireExecutorLocks().","html":"+\u003cspan class=pl-c\u003e\t * cached plan. See AcquireExecutorLocks().\u003c/span\u003e","displayNoNewLineWarning":false,"position":64,"left":523,"right":535},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":536,"text":"+\t */","html":"+\u003cspan class=pl-c\u003e\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":65,"left":523,"right":536},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":537,"text":"+\tif (glob-\u003epartitionOids != NIL \u0026\u0026 glob-\u003eparallelModeNeeded)","html":"+\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-s1\u003eglob\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003epartitionOids\u003c/span\u003e \u003cspan class=pl-c1\u003e!=\u003c/span\u003e \u003cspan class=pl-c1\u003eNIL\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan class=pl-s1\u003eglob\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eparallelModeNeeded\u003c/span\u003e)","displayNoNewLineWarning":false,"position":66,"left":523,"right":537},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":538,"text":"+\t\tresult-\u003epartitionOids = glob-\u003epartitionOids;","html":"+\t\t\u003cspan class=pl-s1\u003eresult\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003epartitionOids\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003eglob\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003epartitionOids\u003c/span\u003e;","displayNoNewLineWarning":false,"position":67,"left":523,"right":538},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":539,"text":" \tresult-\u003einvalItems = glob-\u003einvalItems;","html":" \t\u003cspan class=pl-s1\u003eresult\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003einvalItems\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003eglob\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003einvalItems\u003c/span\u003e;","displayNoNewLineWarning":false,"position":68,"left":524,"right":539},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":540,"text":" \tresult-\u003eparamExecTypes = glob-\u003eparamExecTypes;","html":" \t\u003cspan class=pl-s1\u003eresult\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eparamExecTypes\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003eglob\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003eparamExecTypes\u003c/span\u003e;","displayNoNewLineWarning":false,"position":69,"left":525,"right":540},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":541,"text":" \t/* utilityStmt should be null, but we might as well copy it */","html":" \t\u003cspan class=pl-c\u003e/* utilityStmt should be null, but we might as well copy it */\u003c/span\u003e","displayNoNewLineWarning":false,"position":70,"left":526,"right":541}],"diffNumber":6,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":7786,"linesChanged":37,"newTreeEntry":{"lineCount":7786,"path":"src/backend/optimizer/plan/planner.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/backend/optimizer/plan/planner.c","mode":100644},"linesAdded":26,"linesDeleted":11,"path":"src/backend/optimizer/plan/planner.c","pathDigest":"c6e13617216e8b159a017b78dea5eae9966e17e98e0ba6e818a352ecac5bbcf7","status":"MODIFIED","truncatedReason":null,"oldOid":"0ba71107efeeccde9158f47118f95043afdca0bb","newOid":"05c8482f7f69a954fd65fce85f896e848fc48197","copilotChatReference":null,"deletedSha":"0ba71107efeeccde9158f47118f95043afdca0bb","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"path":"src/backend/optimizer/util/clauses.c","pathDigest":"0d84585297826d3147d3cf926ba397bd19c12b454dc14e8cd6a4833e3a663b07","status":"MODIFIED"},{"path":"src/backend/utils/cache/plancache.c","pathDigest":"7af54257c46128623aefbdf87e424c6a1d6b90f2d91fd900d1fae132c773d589","status":"MODIFIED"},{"path":"src/include/access/xact.h","pathDigest":"a297b1d0bb4a09efcecd07c4fe25f0131483c6703f8b86f0f9ab561fab4c1e61","status":"MODIFIED"},{"path":"src/include/nodes/pathnodes.h","pathDigest":"ad363e84178956ca152dc374d4fbabb6cb8980dd548d359b9af4ad1caf0d037a","status":"MODIFIED"},{"path":"src/include/nodes/plannodes.h","pathDigest":"2658a1ae6156cefca01f7e0fe169073446b923caa722c61dbf33503854860458","status":"MODIFIED"},{"path":"src/include/optimizer/clauses.h","pathDigest":"92c194ae18600016b868868fbc9836718c674e7ba7b80c59d3dbf13172f340ac","status":"MODIFIED"},{"path":"src/test/regress/expected/insert_parallel.out","pathDigest":"6520861a88c71b74d5c307814c42f181ce54ca7902afdbdd33e7633138e676da","status":"ADDED"},{"path":"src/test/regress/parallel_schedule","pathDigest":"42c53b787994f04c9353675a92de1eadb5de0d2458a0ecfd373b79f599bcbecd","status":"MODIFIED"},{"path":"src/test/regress/serial_schedule","pathDigest":"7b3865042fa50957275ce7d80fb877096df471de7aba66ab4e1ba125a66aa97d","status":"MODIFIED"},{"path":"src/test/regress/sql/insert_parallel.sql","pathDigest":"d3b99718c449dceb2656801d3c2517f08dd5e69e58e041f68243cda4e64e32ea","status":"ADDED"}],"splitViewPreference":"unified","ignoreWhitespace":false,"repoOwnerGlobalRelayId":"MDEyOk9yZ2FuaXphdGlvbjE3NzU0Mw==","commentsPreference":"visible","diffLineSpacingPreference":"relaxed","useMonospaceFont":false,"pasteUrlLinkAsPlainText":false,"userNotices":[],"path":"/postgres/postgres/commit/05c8482f7f69a954fd65fce85f896e848fc48197","fileTreeExpanded":true,"headerInfo":{"additions":1531,"deletions":21,"filesChanged":17,"filesChangedString":"17"},"moreDiffsToLoad":true,"asyncDiffLoadInfo":{"startIndex":7,"truncated":false,"byteCount":6671,"lineShownCount":158},"commentInfo":{"canComment":false,"locked":false,"canLock":false,"repoArchived":false},"csrf_tokens":{"/users/diffview?diff=split":{"post":"mKkrCzdPbc-BBWrA6CH2KYnzPhw2vjwKMlcxBzbdcyejodVFidc6Z7vI_jSF8fNOzYJQnC2UZuEvNiC3bS1GCQ"},"/users/diffview?diff=unified":{"post":"it3KIjvlE3EPHxAHLEL9CpOVQKqldQB6zrOM4C6zUu6x1TRshX1E2TXShPNBkvht1-QuKr5fWpHT0p1QdUNnwA"},"/notifications/thread":{"post":"WzO-8aGaRcsB-u5QOlxr_Vcf3W5XV8MdGUVsRc2kh_8cIHyAuniCTb5wOFWtjsnm1NsGcf0tZROpBJl5em7S_A"}}},"title":"Enable parallel SELECT for \"INSERT INTO ... SELECT ...\". · postgres/postgres@05c8482","appPayload":{"helpUrl":"https://docs.github.com","findInDiffWorkerPath":"/assets-cdn/ 8000 worker/find-in-diff-worker-2bfe39677d14.js","enabled_features":{"diff_ux_refresh_beta":false,"diff_inline_comments":true,"diff_ux_refresh_ssr_five":false,"diff_ux_refresh_ssr_ten":false,"react_diff_line_type_character_correction":true}}}

Commit 05c8482

Browse files
author
Amit Kapila
committed
Enable parallel SELECT for "INSERT INTO ... SELECT ...".
Parallel SELECT can't be utilized for INSERT in the following cases: - INSERT statement uses the ON CONFLICT DO UPDATE clause - Target table has a parallel-unsafe: trigger, index expression or predicate, column default expression or check constraint - Target table has a parallel-unsafe domain constraint on any column - Target table is a partitioned table with a parallel-unsafe partition key expression or support function The planner is updated to perform additional parallel-safety checks for the cases listed above, for determining whether it is safe to run INSERT in parallel-mode with an underlying parallel SELECT. The planner will consider using parallel SELECT for "INSERT INTO ... SELECT ...", provided nothing unsafe is found from the additional parallel-safety checks, or from the existing parallel-safety checks for SELECT. While checking parallel-safety, we need to check it for all the partitions on the table which can be costly especially when we decide not to use a parallel plan. So, in a separate patch, we will introduce a GUC and or a reloption to enable/disable parallelism for Insert statements. Prior to entering parallel-mode for the execution of INSERT with parallel SELECT, a TransactionId is acquired and assigned to the current transaction state. This is necessary to prevent the INSERT from attempting to assign the TransactionId whilst in parallel-mode, which is not allowed. This approach has a disadvantage in that if the underlying SELECT does not return any rows, then the TransactionId is not used, however that shouldn't happen in practice in many cases. Author: Greg Nancarrow, Amit Langote, Amit Kapila Reviewed-by: Amit Langote, Hou Zhijie, Takayuki Tsunakawa, Antonin Houska, Bharath Rupireddy, Dilip Kumar, Vignesh C, Zhihong Yu, Amit Kapila Tested-by: Tang, Haiying Discussion: https://postgr.es/m/CAJcOf-cXnB5cnMKqWEp2E2z7Mvcd04iLVmV=qpFJrR3AcrTS3g@mail.gmail.com Discussion: https://postgr.es/m/CAJcOf-fAdj=nDKMsRhQzndm-O13NY4dL6xGcEvdX5Xvbbi0V7g@mail.gmail.com
1 parent 0ba7110 commit 05c8482

File tree

17 files changed

+1531
-21
lines changed

17 files changed

+1531
-21
lines changed

doc/src/sgml/parallel.sgml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ EXPLAIN SELECT * FROM pgbench_accounts WHERE filler LIKE '%x%';
146146
a CTE, no parallel plans for that query will be generated. As an
147147
exception, the commands <literal>CREATE TABLE ... AS</literal>, <literal>SELECT
148148
INTO</literal>, and <literal>CREATE MATERIALIZED VIEW</literal> which create a new
149-
table and populate it can use a parallel plan.
149+
table and populate it can use a parallel plan. Another exception is the command
150+
<literal>INSERT INTO ... SELECT ...</literal> which can use a parallel plan for
151+
the underlying <literal>SELECT</literal> part of the query.
150152
</para>
151153
</listitem>
152154

src/backend/access/transam/xact.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,32 @@ IsInParallelMode(void)
10141014
return CurrentTransactionState->parallelModeLevel != 0;
10151015
}
10161016

1017+
/*
1018+
* PrepareParallelModePlanExec
1019+
*
1020+
* Prepare for entering parallel mode plan execution, based on command-type.
1021+
*/
1022+
void
1023+
PrepareParallelModePlanExec(CmdType commandType)
1024+
{
1025+
if (IsModifySupportedInParallelMode(commandType))
1026+
{
1027+
Assert(!IsInParallelMode());
1028+
1029+
/*
1030+
* Prepare for entering parallel mode by assigning a TransactionId.
1031+
* Failure to do this now would result in heap_insert() subsequently
1032+
* attempting to assign a TransactionId whilst in parallel-mode, which
1033+
* is not allowed.
1034+
*
1035+
* This approach has a disadvantage in that if the underlying SELECT
1036+
* does not return any rows, then the TransactionId is not used,
1037+
* however that shouldn't happen in practice in many cases.
1038+
*/
1039+
(void) GetCurrentTransactionId();
1040+
}
1041+
}
1042+
10171043
/*
10181044
* CommandCounterIncrement
10191045
*/

src/backend/executor/execMain.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,7 +1512,10 @@ ExecutePlan(EState *estate,
15121512

15131513
estate->es_use_parallel_mode = use_parallel_mode;
15141514
if (use_parallel_mode)
1515+
{
1516+
PrepareParallelModePlanExec(estate->es_plannedstmt->commandType);
15151517
EnterParallelMode();
1518+
}
15161519

15171520
/*
15181521
* Loop until we've processed the proper number of tuples from the plan.

src/backend/nodes/copyfuncs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ _copyPlannedStmt(const PlannedStmt *from)
9696
COPY_BITMAPSET_FIELD(rewindPlanIDs);
9797
COPY_NODE_FIELD(rowMarks);
9898
COPY_NODE_FIELD(relationOids);
99+
COPY_NODE_FIELD(partitionOids);
99100
COPY_NODE_FIELD(invalItems);
100101
COPY_NODE_FIELD(paramExecTypes);
101102
COPY_NODE_FIELD(utilityStmt);

src/backend/nodes/outfuncs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ _outPlannedStmt(StringInfo str, const PlannedStmt *node)
314314
WRITE_BITMAPSET_FIELD(rewindPlanIDs);
315315
WRITE_NODE_FIELD(rowMarks);
316316
WRITE_NODE_FIELD(relationOids);
317+
WRITE_NODE_FIELD(partitionOids);
317318
WRITE_NODE_FIELD(invalItems);
318319
WRITE_NODE_FIELD(paramExecTypes);
319320
WRITE_NODE_FIELD(utilityStmt);
@@ -2221,6 +2222,7 @@ _outPlannerGlobal(StringInfo str, const PlannerGlobal *node)
22212222
WRITE_NODE_FIELD(resultRelations);
22222223
WRITE_NODE_FIELD(appendRelations);
22232224
WRITE_NODE_FIELD(relationOids);
2225+
WRITE_NODE_FIELD(partitionOids);
22242226
WRITE_NODE_FIELD(invalItems);
22252227
WRITE_NODE_FIELD(paramExecTypes);
22262228
WRITE_UINT_FIELD(lastPHId);

src/backend/nodes/readfuncs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,6 +1590,7 @@ _readPlannedStmt(void)
15901590
READ_BITMAPSET_FIELD(rewindPlanIDs);
15911591
READ_NODE_FIELD(rowMarks);
15921592
READ_NODE_FIELD(relationOids);
1593+
READ_NODE_FIELD(partitionOids);
15931594
READ_NODE_FIELD(invalItems);
15941595
READ_NODE_FIELD(paramExecTypes);
15951596
READ_NODE_FIELD(utilityStmt);

src/backend/optimizer/plan/planner.c

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,
305305
glob->resultRelations = NIL;
306306
glob->appendRelations = NIL;
307307
glob->relationOids = NIL;
308+
glob->partitionOids = NIL;
308309
glob->invalItems = NIL;
309310
glob->paramExecTypes = NIL;
310311
glob->lastPHId = 0;
@@ -316,16 +317,16 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,
316317
/*
317318
* Assess whether it's feasible to use parallel mode for this query. We
318319
* can't do this in a standalone backend, or if the command will try to
319-
* modify any data, or if this is a cursor operation, or if GUCs are set
320-
* to values that don't permit parallelism, or if parallel-unsafe
321-
* functions are present in the query tree.
320+
* modify any data (except for Insert), or if this is a cursor operation,
321+
* or if GUCs are set to values that don't permit parallelism, or if
322+
* parallel-unsafe functions are present in the query tree.
322323
*
323-
* (Note that we do allow CREATE TABLE AS, SELECT INTO, and CREATE
324-
* MATERIALIZED VIEW to use parallel plans, but as of now, only the leader
325-
* backend writes into a completely new table. In the future, we can
326-
* extend it to allow workers to write into the table. However, to allow
327-
* parallel updates and deletes, we have to solve other problems,
328-
* especially around combo CIDs.)
324+
* (Note that we do allow CREATE TABLE AS, INSERT INTO...SELECT, SELECT
325+
* INTO, and CREATE MATERIALIZED VIEW to use parallel plans. However, as
326+
* of now, only the leader backend writes into a completely new table. In
327+
* the future, we can extend it to allow workers to write into the table.
328+
* However, to allow parallel updates and deletes, we have to solve other
329+
* problems, especially around combo CIDs.)
329330
*
330331
* For now, we don't try to use parallel mode if we're running inside a
331332
* parallel worker. We might eventually be able to relax this
@@ -334,13 +335,14 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,
334335
*/
335336
if ((cursorOptions & CURSOR_OPT_PARALLEL_OK) != 0 &&
336337
IsUnderPostmaster &&
337-
parse->commandType == CMD_SELECT &&
338+
(parse->commandType == CMD_SELECT ||
339+
is_parallel_allowed_for_modify(parse)) &&
338340
!parse->hasModifyingCTE &&
339341
max_parallel_workers_per_gather > 0 &&
340342
!IsParallelWorker())
341343
{
342344
/* all the cheap tests pass, so scan the query tree */
343-
glob->maxParallelHazard = max_parallel_hazard(parse);
345+
glob->maxParallelHazard = max_parallel_hazard(parse, glob);
344346
glob->parallelModeOK = (glob->maxParallelHazard != PROPARALLEL_UNSAFE);
345347
}
346348
else
@@ -521,6 +523,19 @@ standard_planner(Query *parse, const char *query_string, int cursorOptions,
521523
result->rewindPlanIDs = glob->rewindPlanIDs;
522524
result->rowMarks = glob->finalrowmarks;
523525
result->relationOids = glob->relationOids;
526+
527+
/*
528+
* Register the Oids of parallel-safety-checked partitions as plan
529+
* dependencies. This is only really needed in the case of a parallel plan
530+
* so that if parallel-unsafe properties are subsequently defined on the
531+
* partitions, the cached parallel plan will be invalidated, and a
532+
* non-parallel plan will be generated.
533+
*
534+
* We also use this list to acquire locks on partitions before executing
535+
* cached plan. See AcquireExecutorLocks().
536+
*/
537+
if (glob->partitionOids != NIL && glob->parallelModeNeeded)
538+
result->partitionOids = glob->partitionOids;
524539
result->invalItems = glob->invalItems;
525540
result->paramExecTypes = glob->paramExecTypes;
526541
/* utilityStmt should be null, but we might as well copy it */

0 commit comments

Comments
 (0)
0