楼主: olive

如何解决不同SQL之间的性能冲突?

[复制链接]
论坛徽章:
3
ITPUB元老
日期:2005-02-28 12:57:00授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34
21#
发表于 2002-4-26 14:40 | 只看该作者
try this , Please set autotrace on in sqlplus then put the result here
select
tacct.body_nb bodynb,
tacct.nb acctnb,
tacct.actype_ty,
tacct.blccl_nb blcclnb,
tacct.cstgrp_nb cstgrpnb,
tprprty.propty_cd proptycd,
tprprty.nb prprtynb,
tbtchdt.nb_walk_order nbwalkorder
from      tbtchdt ,  tdelpnt , tprprty, taddrid, tprpacc, tbody, tacct
where tbtchdt.batch_nb=269 and
tacct.nb = tprpacc.acct_nb  and
tacct.body_nb  = tbody.nb  and
tacct.blccl_nb = tbtchdt.blccl_nb and
tacct.cstgrp_nb = tbtchdt.cstgrp_nb  and
tacct.body_nb  = tprpacc.body_nb  and
taddrid.sectn_cd = tbtchdt.sectn_cd and
tbody.addrid_cd = taddrid.cd and
tprpacc.prprty_nb=tprprty.nb and
tprpacc.dt_end is null and
tprprty.nb=tdelpnt.prprty_nb and
tdelpnt.in_ocpl='2'
order by tacct.body_nb

使用道具 举报

回复
论坛徽章:
3
ITPUB元老
日期:2005-02-28 12:57:00授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34
22#
发表于 2002-4-26 15:12 | 只看该作者
and this


select /*+use_hash(tacct,taddrid, tbody) full(tbody) full(taddrid) full(tacct)*/
tacct.body_nb bodynb,
tacct.nb acctnb,
tacct.actype_ty,
tacct.blccl_nb blcclnb,
tacct.cstgrp_nb cstgrpnb,
tprprty.propty_cd proptycd,
tprprty.nb prprtynb,
tbtchdt.nb_walk_order nbwalkorder
from  tdelpnt , tprprty, tprpacc, tbody, tacct, taddrid, tbtchdt
where tbtchdt.batch_nb=269 and
tbtchdt.blccl_nb = tacct.blccl_nb and
tbtchdt.cstgrp_nb = tacct.cstgrp_nb and
tbtchdt.sectn_cd = taddrid.sectn_cd and
taddrid.cd  = tbody.addrid_cd and
tacct.body_nb  = tbody.nb  and
tprpacc.body_nb = tacct.body_nb   and
tacct.nb = tprpacc.acct_nb  and
tprpacc.prprty_nb=tprprty.nb and
tprpacc.dt_end is null and
tprprty.nb=tdelpnt.prprty_nb and
tdelpnt.in_ocpl='2'
order by tacct.body_nb

使用道具 举报

回复
论坛徽章:
3
ITPUB元老
日期:2005-02-28 12:57:00授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34
23#
发表于 2002-4-26 16:21 | 只看该作者
我用的也是7.3.4
只要建立一个
create table PLAN_TABLE (
        statement_id    varchar2(30),
        timestamp       date,
        remarks         varchar2(80),
        operation       varchar2(30),
        options         varchar2(30),
        object_node     varchar2(128),
        object_owner    varchar2(30),
        object_name     varchar2(30),
        object_instance numeric,
        object_type     varchar2(30),
        optimizer       varchar2(255),
        search_columns  numeric,
        id              numeric,
        parent_id       numeric,
        position        numeric,
        cost            numeric,
        cardinality     numeric,
        bytes           numeric,
        other_tag       varchar2(255),
        other           long);
就可以用
autotrace了


如果是OLTP的话还是太慢了.

使用道具 举报

回复
论坛徽章:
3
ITPUB元老
日期:2005-02-28 12:57:00授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34
24#
发表于 2002-4-28 08:28 | 只看该作者
好运

使用道具 举报

回复
论坛徽章:
3
ITPUB元老
日期:2005-02-28 12:57:00授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34
25#
发表于 2002-4-28 09:58 | 只看该作者
to  dblife
我做了你的实验的确发生了这个情况.
找了一下资料发现了下面的一段话
Note: If you want to collect statistics on both the table as a whole and on one or more
columns, be sure to generate the statistics for the table first, and then for the columns.
Otherwise, the table-only ANALYZE will overwrite the histograms generated by the
column ANALYZE. For example, issue the following statements:
ANALYZE TABLE emp ESTIMATE STATISTICS;
ANALYZE TABLE emp ESTIMATE STATISTICS FOR ALL COLUMNS;


我想你应该先做
ANALYZE TABLE emp ESTIMATE STATISTICS;
ANALYZE TABLE emp ESTIMATE STATISTICS FOR ALL indexes;

使用道具 举报

回复
论坛徽章:
3
ITPUB元老
日期:2005-02-28 12:57:00授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34
26#
发表于 2002-4-28 10:29 | 只看该作者
最初由 parrotao 发布
[B]to  dblife

Otherwise, the table-only ANALYZE will overwrite the histograms generated by the
column ANALYZE.

但是我想这不是你出问题的原因
但我先ANALYZE TABLE
然后再ANALYZE TABLE FOR ALL INDEXES
就OK了


好奇怪呀呀呀呀呀呀呀呀呀呀呀呀

使用道具 举报

回复
论坛徽章:
3
ITPUB元老
日期:2005-02-28 12:57:00授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34
27#
发表于 2002-4-28 14:36 | 只看该作者
没有删过呀!????

使用道具 举报

回复
论坛徽章:
3
ITPUB元老
日期:2005-02-28 12:57:00授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34
28#
发表于 2002-4-28 14:56 | 只看该作者
给个URL我也去看看

使用道具 举报

回复
论坛徽章:
3
ITPUB元老
日期:2005-02-28 12:57:00授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34
29#
发表于 2002-4-29 15:03 | 只看该作者
谢谢大家了!又学了一招!
哈哈

使用道具 举报

回复
论坛徽章:
3
ITPUB元老
日期:2005-02-28 12:57:00授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34
30#
发表于 2002-4-29 16:43 | 只看该作者
看他自动产生的SQL最后一句话AND tdelpnt.prprty_nb = tprpacc.prprty_nb + 0
和实际逻辑的tdelpnt.prprty_nb = tprprty.nb and
是不同的,咋一看好象有问题
其实已经有AND tprprty.nb = tprpacc.prprty_nb
所以prprty_nb 和tprprty.nb可以互相交换的
这样就有更多的sql组合了
优化时不必局限于逻辑

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表