v.24.12Improvement
Respect prefer_locahost_replica in distributed INSERT ... SELECT plans
Respectprefer_locahost_replicawhen building plan for distributedINSERT ... SELECT. #72190 (filimonov).
Why it matters
This feature ensures that when performing distributed inserts combined with select queries, the planner prioritizes executing on the local replica ifprefer_localhost_replica is enabled. This improves query performance and resource utilization by reducing network overhead and data movement.How to use it
Enable theprefer_localhost_replica setting in the session or server configuration before executing distributed INSERT ... SELECT queries. For example, set the parameter as follows:SET prefer_localhost_replica = 1;Then run your distributed
INSERT ... SELECT query as usual.