Skip to content

Commit b055cd1

Browse files
committed
only push limit down if 1 thread and can use main
1 parent eed717b commit b055cd1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/storage/postgres_optimizer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ static void OptimizePostgresScanLimitPushdown(unique_ptr<LogicalOperator> &op) {
5454
}
5555

5656
auto &bind_data = get.bind_data->Cast<PostgresBindData>();
57+
if (bind_data.max_threads != 1 || !bind_data.can_use_main_thread) {
58+
// cannot push down limit/offset if we are not using the main thread
59+
OptimizePostgresScanLimitPushdown(op->children[0]);
60+
return;
61+
}
5762

5863
string generated_limit_clause = "";
5964
if (limit.limit_val.Type() != LimitNodeType::UNSET) {

0 commit comments

Comments
 (0)