最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501
当前位置: 首页 - 科技 - 知识百科 - 正文

表统计信息过旧导致执行慢的sql优化

来源:懂视网 责编:小采 时间:2020-11-09 07:33:46
文档

表统计信息过旧导致执行慢的sql优化

表统计信息过旧导致执行慢的sql优化:UPDATE T_PUB_HF_TASKPOOL_IN L SET L.FETCH_ID = :B1 WHERE L.TASK_GROUP_ID = (SELECT TASK_GROUP_ID FROM (SELECT TASK_GROUP_ID FROM (SELECT /* leading(tg,t) index(t,IDX_HF_TASKPOOL_ORGID) */ TASK_GROUP_ID, T.BATCH_ID, (SELECT P.PRIORITY FROM
推荐度:
导读表统计信息过旧导致执行慢的sql优化:UPDATE T_PUB_HF_TASKPOOL_IN L SET L.FETCH_ID = :B1 WHERE L.TASK_GROUP_ID = (SELECT TASK_GROUP_ID FROM (SELECT TASK_GROUP_ID FROM (SELECT /* leading(tg,t) index(t,IDX_HF_TASKPOOL_ORGID) */ TASK_GROUP_ID, T.BATCH_ID, (SELECT P.PRIORITY FROM

UPDATE T_PUB_HF_TASKPOOL_IN L SET L.FETCH_ID = :B1 WHERE L.TASK_GROUP_ID = (SELECT TASK_GROUP_ID FROM (SELECT TASK_GROUP_ID FROM (SELECT /* leading(tg,t) index(t,IDX_HF_TASKPOOL_ORGID) */ TASK_GROUP_ID, T.BATCH_ID, (SELECT P.PRIORITY FROM

UPDATE T_PUB_HF_TASKPOOL_IN L

SET L.FETCH_ID = :B1

WHERE L.TASK_GROUP_ID =

(SELECT TASK_GROUP_ID

FROM (SELECT TASK_GROUP_ID

FROM (SELECT /*+ leading(tg,t) index(t,IDX_HF_TASKPOOL_ORGID) */

TASK_GROUP_ID,

T.BATCH_ID,

(SELECT P.PRIORITY

FROM T_PUB_HF_PRIORITY P

WHERE P.SUB_BIZMODEL = T.SUB_BIZMODEL

AND NVL(P.BIZMODEL_TYPE, '00') =

NVL(T.BIZMODEL_TYPE, '00')

AND P.STATUS = '1') PRIORITY,

(SELECT 1

FROM T_PUB_HF_PRIORITY_ORG O

WHERE O.SUB_BIZMODEL = T.SUB_BIZMODEL

AND O.ORG_ID = T.ORG_ID) PRIORITYORG

FROM T_PUB_HF_TASKPOOL_IN T, T_PUB_HF_ATTR_TMR TG

WHERE T.SUB_BIZMODEL = TG.SUB_BIZMODEL

AND TG.ORG_ID = T.ORG_ID

AND TG.TMR_ID = :B3

AND TG.TL_UM_ID = :B2

AND T.FETCH_ID IS NULL

AND T.STATUS IS NULL)

ORDER BY PRIORITY, PRIORITYORG, BATCH_ID)

WHERE ROWNUM = 1)

用户提供不了绑定变量,只能我自己尝试。

select TMR_ID,count(*) from T_PUB_HF_ATTR_TMR group by tmr_id order by count(*) desc;

--有58行被选择,只截取前面10行,其余剩下的基本是45与44.

\

select TL_UM_ID,count(*) from T_PUB_HF_ATTR_TMR group by TL_UM_ID order by count(*) desc;

\

代入绑定变量后的值。Buffer get是6168

UPDATE /*+gather_plan_statistics fwy1758*/T_PUB_HF_TASKPOOL_IN L<喎?http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+ICAgU0VUIEwuRkVUQ0hfSUQgPSA="abcfwy'

WHERE L.TASK_GROUP_ID =

(SELECT TASK_GROUP_ID

FROM (SELECT TASK_GROUP_ID

FROM (SELECT /*+ leading(tg,t) index(t,IDX_HF_TASKPOOL_ORGID) */

TASK_GROUP_ID,

T.BATCH_ID,

(SELECT P.PRIORITY

FROM T_PUB_HF_PRIORITY P

WHERE P.SUB_BIZMODEL = T.SUB_BIZMODEL

AND NVL(P.BIZMODEL_TYPE, '00') =

NVL(T.BIZMODEL_TYPE, '00')

AND P.STATUS = '1') PRIORITY,

(SELECT 1

FROM T_PUB_HF_PRIORITY_ORG O

WHERE O.SUB_BIZMODEL = T.SUB_BIZMODEL

AND O.ORG_ID = T.ORG_ID) PRIORITYORG

FROM T_PUB_HF_TASKPOOL_IN T, T_PUB_HF_ATTR_TMR TG

WHERE T.SUB_BIZMODEL = TG.SUB_BIZMODEL

AND TG.ORG_ID = T.ORG_ID

AND TG.TMR_ID = 'LIUYAOYUN692'

AND TG.TL_UM_ID = 'SUNYAN032'

AND T.FETCH_ID IS NULL

AND T.STATUS IS NULL)

ORDER BY PRIORITY, PRIORITYORG, BATCH_ID)

WHERE ROWNUM = 1)

\

查看详细的执行计划,红圈的返回行数估算是错误的,可以预计,t_pub_hf_taskpool_in表以及其索引的统计信息有误。

\

经查看,t_pub_hf_taskpool_in表最后统计信息更新日期是2014/3/5 3:53:03,有1500行。而今天3月10日,已经是212095行,可能做过批量加载数据。

在cow库尝试对t_pub_hf_taskpool_in表及其统计信息进行收集,完了后再跑sql。

此时buffer get已经下降到2590,性能提升两倍以上。

声明:本网页内容旨在传播知识,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文档

表统计信息过旧导致执行慢的sql优化

表统计信息过旧导致执行慢的sql优化:UPDATE T_PUB_HF_TASKPOOL_IN L SET L.FETCH_ID = :B1 WHERE L.TASK_GROUP_ID = (SELECT TASK_GROUP_ID FROM (SELECT TASK_GROUP_ID FROM (SELECT /* leading(tg,t) index(t,IDX_HF_TASKPOOL_ORGID) */ TASK_GROUP_ID, T.BATCH_ID, (SELECT P.PRIORITY FROM
推荐度:
标签: 信息 数据库 sql
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top