数据库远程连接查询优化实验

      连接两个远程表,比连接两个本地表要昂贵的多!所以建议先在远程环境做好连接后,在远程的机器上建立一个视图,我们本地再访问这个视图。原因是用视图封装以后,数据操作在远程就做了,不用传输到本地再作处理,减少了数据传输。

      SQL太长,只显示结果10046跟踪的结果。

1.在远程数据库上建视图用时:  00: 00: 35.73
call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.00          0          0          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch     3847      1.90      10.13          0          0          0       57677
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total     3849      1.90      10.14          0          0          0       57677
Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to dblink                    3849        0.00          0.00
  SQL*Net message from dblink                  3849        0.05          7.15
  SQL*Net more data from dblink                8684        0.00          0.78
  SQL*Net message to client                    3847        0.00          0.00
  SQL*Net more data to client                  8889        0.00          0.09
  SQL*Net message from client                  3847        0.01         25.25
********************************************************************************

2.直接在本地连表查询用时:  00: 00: 38.56
call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.07          0          0          0           0
Execute      1      0.01       0.00          0          0          0           0
Fetch     3847      1.17      12.36          0          0          0       57677
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total     3849      1.18      12.44          0          0          0       57677
Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to dblink                    3847        0.00          0.00
  SQL*Net more data to dblink                     1        0.00          0.00
  SQL*Net message from dblink                  3847        0.01          9.39
  SQL*Net more data from dblink                8683        0.00          0.81
  SQL*Net message to client                    3847        0.00          0.00
  SQL*Net more data to client                  8889        0.00          0.09
  SQL*Net message from client                  3847        0.01         25.75
********************************************************************************

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值