diff --git a/src/Storages/StorageDistributed.cpp b/src/Storages/StorageDistributed.cpp index 4f5a95ab508..41338c55d20 100644 --- a/src/Storages/StorageDistributed.cpp +++ b/src/Storages/StorageDistributed.cpp @@ -1030,7 +1030,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,