parallel_distributed_insert_select
Enables parallel distributedINSERT ... SELECT query.
If we execute INSERT INTO distributed_table_a SELECT ... FROM distributed_table_b queries and both tables use the same cluster, and both tables are either replicated or non-replicated, then this query is processed locally on every shard.
Possible values:
0— Disabled.1—SELECTwill be executed on each shard from the underlying table of the distributed engine.2—SELECTandINSERTwill be executed on each shard from/to the underlying table of the distributed engine.
INSERT ... SELECT from a ReplicatedMergeTree or SharedMergeTree source can also be parallelized across replicas. To enable it:
parallel_distributed_insert_select = 2enable_parallel_replicas = 1
The rewritten query, including every expression of the
SELECT (subqueries, UDFs, and so on), is executed on the shards under the credentials of the cluster configuration — the same trust model as other shard-side processing, such as the subqueries of a non-GLOBAL IN. Configure an interserver secret (the secret element of the cluster configuration) if shard-side reads must be authorized as the calling user.parallel_hash_join_threshold
For anINNER, LEFT, RIGHT or FULL hash join, this threshold decides how the hash table is built.
If the estimated number of rows in the right table is below the threshold, the join builds the hash table as one part, on one thread.
At or above the threshold, and also when there is no estimate, the join splits the hash table into parts that up to max_threads threads fill at the same time (one thread with max_threads = 1).
0 always splits the hash table.
With hash_join_layout set to serial or parallel, this threshold is not used: the join builds one part or splits the hash table, whatever the estimate.
The estimate comes from the query plan, or from the statistics of earlier runs of the same join (see collect_hash_table_stats_during_joins).
The query plan estimates 0 rows for a right table known to be empty, such as a MergeTree table without data parts.
ASOF joins never get an estimate, and with query_plan_optimize_join_order_limit = 0 no join gets one.
parallel_non_joined_rows_processing
Allow multiple threads to process non-joined rows from the right table in parallel during RIGHT and FULL JOINs. This can speed up the non-joined phase of hash joins with large right tables that build the hash table on several threads (seeparallel_hash_join_threshold).
When disabled, or when the hash table is built on one thread, non-joined rows are processed by a single thread.
In every case the non-joined rows come out in no fixed order. Use ORDER BY when the query needs a stable order.