对pl/sql 语句的优化(上集)
对这个进行优化
select n5001 门店,n5002 部门,n5004 小分类,n5019 商品编码,c01d21 商品名称,
nvl(xse,0)-nvl(dzxs,0) 销售,
mle 毛利,
nvl(xl,0)-nvl(dzsl,0) 销量
from
(select n5001,n5002,n5004,n5019,sum(n5011) xse,sum(n5016) mle,sum(n5023) xl
from n50
where to_char(n5010,'yyyymmdd')>='20100401'
and to_char(n5010,'yyyymmdd')<='20100431'
group by n5001,n5002,n5004,n5019),
(select g08,g09,g02,sum(g03*g07) dzxs,sum(G03) dzsl from batchgoods
where to_char(g04,'yyyymmdd')>='20100401'
and to_char(g04,'yyyymmdd')<='20100431'
group by g08,g09,g02),c01d
where n5001=g08(+)
and n5019=g02(+)
and n5001=c01d00(+)
and n5019=c01d01(+)
执行计划
SELECT STATEMENT, GOAL = CHOOSE Cost=10060 Cardinality=3931 Bytes=475651
MERGE JOIN OUTER Cost=10060 Cardinality=3931 Bytes=475651
SORT JOIN Cost=8063 Cardinality=3931 Bytes=338066
NESTED LOOPS OUTER Cost=7952 Cardinality=3931 Bytes=338066
VIEW Object owner=FZDC Cost=4015 Cardinality=3931 Bytes=239791
SORT GROUP BY Cost=4015 Cardinality=3931 Bytes=149378
TABLE ACCESS FULL Object owner=FZDC Object name=N50 Cost=3955 Cardinality=3931 Bytes=149378
TABLE ACCESS BY INDEX ROWID Object owner=FZDC Object name=C01D  
相关文档:
1. 安装oracle 10G客户端
要访问oracle数据库必须安装oracle客户端。安装oracle客户端有两种方式,即完整安装和立即安装,这两种方式都可以。安装完后配置要链接数据库服务器。
$ORACLE_HOME\network\admin\tnsname.ora
在此配置文件里添加如下内容:
sunora =
(DESCRIPTION =
......
适用环境
操作系统:windows 2003
数据库:sql server 2000/sql server 2005
使用链接服务器进行远程数据库访问的情况
一、 问题现象
在执行分布式事务时,在sql server 2005下收到如下错误:
消息 7391,级别 16,状态 2,过程 xxxxx,第 16 行
无法执行该操作,因为链接服务器 "xxxxx" 的 OLE DB 访问接口 " ......
--该表保存结果
create table c(c1 tinyint, c2 tinyint, c3 tinyint, c4 tinyint, c5 tinyint, c6 tinyint, c7 tinyint, c8 tinyint, c9 tinyint, c10 tinyint, c11 tinyint, c12 tinyint, c13 tinyint, c14 tinyint, c15 tinyint, c16 tinyint, c17 tinyint, c18 tinyint, c19 tinyint, c20 tinyint, c21 tinyint, c22 t ......
1.
SQL> desc gjh_a05 ;
Name Type Nullable Default Comments
----- ------------- -------- ------- --------
A0500 VARCHAR2(2) Y &nbs ......