diff --git a/src/Storages/StorageDistributed.cpp b/src/Storages/StorageDistributed.cpp index cc55b2ae271..02b9751ae24 100644 --- a/src/Storages/StorageDistributed.cpp +++ b/src/Storages/StorageDistributed.cpp @@ -838,7 +838,7 @@ std::optional StorageDistributed::distributedWriteBetweenDistribu for (size_t shard_index : collections::range(0, shards_info.size())) { const auto & shard_info = shards_info[shard_index]; - if (shard_info.isLocal()) + if (shard_info.isLocal() && settings.prefer_localhost_replica) { InterpreterInsertQuery interpreter(new_query, query_context); pipeline.addCompletedPipeline(interpreter.execute().pipeline);