数据库远程连接查询优化实验
2012-10-29 09:24
447 查看
连接两个远程表,比连接两个本地表要昂贵的多!所以建议先在远程环境做好连接后,在远程的机器上建立一个视图,我们本地再访问这个视图。原因是用视图封装以后,数据操作在远程就做了,不用传输到本地再作处理,减少了数据传输。
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
********************************************************************************
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
********************************************************************************
相关文章推荐
- SQL语句远程连接其他数据库查询表数据
- Sql server 日记 (远程连接数据库库查询数据库)
- orcle 远程连接其他数据库 进行查询数据
- Day51、数据库、远程连接服务器、查询select语句、form字句、where字句、order by 子句
- 数据库的优化(非连接查询和连接查询的巧用)
- 数据库的优化(非连接查询和连接查询的巧用)
- Sqlserver2008 远程连接数据库查询
- 远程连接数据库查询
- SqlServer 连接远程服务器数据库 实现跨服务器联合查询
- Jsp中连接数据库写sql查询
- PL/SQl developer远程连接数据库
- 数据库优化--优化查询语句
- Navicat for mysql远程连接数据库详(1130错误解决方法)
- 使用PLSQL配置监听连接远程数据库
- 使用连接(JOIN)来代替子查询(Sub-Queries) mysql优化系列记录
- CentOS下开启mysql远程连接,远程管理数据库
- MySQL5.7性能优化系列(二)——SQL语句优化(2)——使用 Semi-Join半连接变换优化子查询,派生表和视图
- 通过任意键查询对象+在action中通过配置文件连接数据库 问题
- 数据库多表连接查询(外连接和内连接)
- 用户sa登入失败,该用户与可信SQL server连接无关联 错误18452(远程数据库访问)