diff --git a/datafusion/core/src/datasource/listing/table.rs b/datafusion/core/src/datasource/listing/table.rs index 9b9bcd22c4647..97fa83eacae51 100644 --- a/datafusion/core/src/datasource/listing/table.rs +++ b/datafusion/core/src/datasource/listing/table.rs @@ -1112,7 +1112,9 @@ impl ListingTable { ) })) .await?; - let file_list = stream::iter(file_list).flatten(); + let meta_fetch_concurrency = + ctx.config_options().execution.meta_fetch_concurrency; + let file_list = stream::iter(file_list).flatten_unordered(meta_fetch_concurrency); // collect the statistics if required by the config let files = file_list .map(|part_file| async { @@ -1129,7 +1131,7 @@ impl ListingTable { } }) .boxed() - .buffered(ctx.config_options().execution.meta_fetch_concurrency); + .buffer_unordered(ctx.config_options().execution.meta_fetch_concurrency); let (files, statistics) = get_statistics_with_limit( files,