Skip to content

Commit d736fde

Browse files
committed
Calculate number of parallel workers on scan for count_tuples_only
1 parent 1302610 commit d736fde

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/scan/postgres_table_reader.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,17 @@ PostgresTableReader::PostgresTableReader(const char *table_scan_query, bool coun
6969
/* Temp tables can be excuted with parallel workers, and whole plan should be parallel aware */
7070
if (run_scan_with_parallel_workers) {
7171

72+
int parallel_workers = 0;
7273
if (count_tuples_only) {
7374
/* For count_tuples_only we will try to execute aggregate node on table scan */
7475
planned_stmt->planTree->parallel_aware = true;
7576
MarkPlanParallelAware((Plan *)table_scan_query_desc->planstate->plan->lefttree);
77+
parallel_workers = ParallelWorkerNumber(planned_stmt->planTree->lefttree->plan_rows);
7678
} else {
7779
MarkPlanParallelAware(table_scan_query_desc->planstate->plan);
80+
parallel_workers = ParallelWorkerNumber(planned_stmt->planTree->plan_rows);
7881
}
7982

80-
int parallel_workers = ParallelWorkerNumber(planned_stmt->planTree->plan_rows);
8183
bool interrupts_can_be_process = INTERRUPTS_CAN_BE_PROCESSED();
8284

8385
if (!interrupts_can_be_process) {

0 commit comments

Comments
 (0)