https://clickhouse.yandex/docs/en/operations/settings/settings/
distributed_product_mode¶
Changes the behavior of distributed subqueries.
ClickHouse applies this setting when the query contains the product of distributed tables, i.e. when the query for a distributed table contains a non-GLOBAL subquery for the distributed table.
Restrictions:
- Only applied for IN and JOIN subqueries.
- Only if the FROM section uses a distributed table containing more than one shard.
- If the subquery concerns a distributed table containing more than one shard,
- Not used for a table-valued remote function.
The possible values are:
deny
— Default value. Prohibits using these types of subqueries (returns the "Double-distributed in/JOIN subqueries is denied" exception).local
— Replaces the database and table in the subquery with local ones for the destination server (shard), leaving the normalIN
/JOIN.
global
— Replaces theIN
/JOIN
query withGLOBAL IN
/GLOBAL JOIN.
allow
— Allows the use of these types of subqueries.- https://blog.csdn.net/ma15732625261/article/details/86607199
-
分布式子查詢
帶有子查詢的in
1、普通in,查詢發送到遠程服務器,且每個服務器中運行in或join子句的子查詢
2、global in、global join時,先為global in、global join運行所有子查詢,將結果收到臨時表且將表發給每個服務器,使用臨時表運行查詢
非分布式查詢,使用普通的in、join
假設集群中每個服務器都存在一個正常表local_table,與分布式表distributed_table
對distributed_table查詢,查詢被送到服務器且使用local_table運行查詢