分布式查询的查询计划

可以显示为分布式查询选择的查询计划。为分布式连接显示的信息不同于为本地连接显示的信息。

下图显示了为分布式查询选择的查询计划。

图: 分布式查询的 SET EXPLAIN ALL 选择输出,第 3 部分

QUERY:
------
select l.customer_num, l.lname, l.company,
         l.phone, r.call_dtime, r.call_descr
       from customer l, vjp_stores@gilroy:cust_calls r
        where l.customer_num = r.customer_num

Estimated Cost: 9
Estimated # of Rows Returned: 7

  1) gbasedbt.r: REMOTE PATH

  2) gbasedbt.l: INDEX PATH

    (1) Index Keys: customer_num   (Serial, fragments: ALL)
        Lower Index Filter: gbasedbt.l.customer_num = gbasedbt.r.customer_num
NESTED LOOP JOIN

下表显示了为分布式连接和本地连接选择的查询计划的主要区别。

分布式查询的图 1 中的输出行 仅本地查询的图 1 中的输出行 区别的描述
vjp_stores@gilroy: virginia.cust_calls gbasedbt.cust_calls 远程表名以数据库和服务器名称开头。
Estimated Cost: 9 Estimated Cost: 7 优化器为分布式查询估计的成本较高。
gbasedbt.r: REMOTE PATH gbasedbt.r: SEQUENTIAL SCAN 优化器选择在远程站点保存外部远程 cust_calls 表。
select x0.call_dtime,x0.call_descr,x0. customer_num from vjp_stores:”virginia”.cust_ calls x0   本地数据库服务器发送到远程站点的 SQL 语句。 远程站点重新优化该语句以选择实际计划。