Skip to content

Commit 5acbf4e

Browse files
yjhjstzyjhjstz
authored andcommitted
Enable insert multiple file on AO tables.
Changes: When enable_parallel is on, the insertMultiFiles flag is set to true when: gp_appendonly_insert_files GUC value is greater than 1 (indicating multiple files used) and the insert is not reserving a specific segment. When insertMultiFiles is true, data will be appended to multiple file segments in parallel. The default value of gp_appendonly_insert_files GUC is increased from 0 to 4, to enable up to 4 parallel insert files by default. This allows append-only tables to scale insert performance by writing to multiple file segments in parallel. The number of parallel segments can be configured using the gp_appendonly_insert_files GUC.
1 parent 824f4e8 commit 5acbf4e

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/backend/access/aocs/aocsam.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,9 @@ aocs_insert_init(Relation rel, int segno)
10681068
rel, segno, tupleDesc->natts, true);
10691069

10701070
/* should not enable insertMultiFiles if the table is created by own transaction */
1071-
desc->insertMultiFiles = ((gp_appendonly_insert_files > 1) && !ShouldUseReservedSegno(rel, CHOOSE_MODE_WRITE));
1071+
desc->insertMultiFiles = enable_parallel &&
1072+
gp_appendonly_insert_files > 1 &&
1073+
!ShouldUseReservedSegno(rel, CHOOSE_MODE_WRITE);
10721074
return desc;
10731075
}
10741076

src/backend/access/appendonly/appendonlyam.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2852,7 +2852,9 @@ aoInsertDesc->appendOnlyMetaDataSnapshot, //CONCERN:Safe to assume all block dir
28522852
rel, segno, 1, false);
28532853

28542854
/* should not enable insertMultiFiles if the table is created by own transaction */
2855-
aoInsertDesc->insertMultiFiles = ((gp_appendonly_insert_files > 1) && !ShouldUseReservedSegno(rel, CHOOSE_MODE_WRITE));
2855+
aoInsertDesc->insertMultiFiles = enable_parallel &&
2856+
gp_appendonly_insert_files > 1 &&
2857+
!ShouldUseReservedSegno(rel, CHOOSE_MODE_WRITE);
28562858
return aoInsertDesc;
28572859
}
28582860

src/backend/utils/misc/guc_gp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3165,7 +3165,7 @@ struct config_int ConfigureNamesInt_gp[] =
31653165
NULL
31663166
},
31673167
&gp_appendonly_insert_files,
3168-
0, 0, 127,
3168+
4, 0, 127,
31693169
NULL, NULL, NULL
31703170
},
31713171

0 commit comments

Comments
 (0)