暂无图片
分享
tianhy
2019-08-16
查询总数不出结果,cpu使用很高

查询总数不出结果,cpu使用很高


trace文件:

KPROF: Release 11.2.0.4.0 - Development on Fri Aug 16 12:42:21 2019


Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


Trace file: orcl_ora_24840.trc

Sort options: default


********************************************************************************

count    = number of times OCI procedure was executed

cpu      = cpu time in seconds executing 

elapsed  = elapsed time in seconds executing

disk     = number of physical reads of buffers from disk

query    = number of buffers gotten for consistent read

current  = number of buffers gotten in current mode (usually for update)

rows     = number of rows processed by the fetch or execute call

********************************************************************************


select count(1)

  from gdhysms.cs_mt_bak_two a

 WHERE 1 = 1

   and exists (select mid

                  from gdhysms.cs_resp_two

                 where 1 = 1

                   and result = 100 and a.id=mid)

   and a.request_time >=to_date('2019-08-16 00:00:00','yyyy-MM-dd hh24:mi:ss') and

   a.request_time <= to_date('2019-08-16 23:59:59','yyyy-MM-dd hh24:mi:ss')


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        1    107.74     107.77          0   27019892          0           0

------- ------  -------- ---------- ---------- ---------- ----------  ----------

total        3    107.75     107.77          0   27019892          0           0


Misses in library cache during parse: 1

Optimizer mode: ALL_ROWS

Parsing user id: SYS

Number of plan statistics captured: 1


Rows (1st) Rows (avg) Rows (max)  Row Source Operation

---------- ---------- ----------  ---------------------------------------------------

         0          0          0  SORT AGGREGATE (cr=0 pr=0 pw=0 time=34 us)

      3554       3554       3554   NESTED LOOPS SEMI (cr=27015806 pr=0 pw=0 time=106946721 us cost=0 size=64 card=1)

      4591       4591       4591    TABLE ACCESS BY INDEX ROWID CS_MT_BAK_TWO (cr=292 pr=0 pw=0 time=11641 us cost=0 size=30 card=1)

      4591       4591       4591     INDEX RANGE SCAN IDX_MT_TWO_REQUEST (cr=15 pr=0 pw=0 time=4186 us cost=0 size=0 card=1)(object id 88013)

      3554       3554       3554    TABLE ACCESS BY INDEX ROWID CS_RESP_TWO (cr=27015514 pr=0 pw=0 time=107735010 us cost=0 size=34 card=1)

 241277792  241277792  241277792     INDEX RANGE SCAN IDX_RESP_TWO_RESULT (cr=1099853 pr=0 pw=0 time=64449601 us cost=0 size=0 card=1)(object id 98882)



Elapsed times include waiting on following events:

  Event waited on                             Times   Max. Wait  Total Waited

  ----------------------------------------   Waited  ----------  ------------

  SQL*Net message to client                       1        0.00          0.00

  SQL*Net break/reset to client                   1        0.00          0.00

  SQL*Net message from client                     1       10.84         10.84




********************************************************************************


OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS


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        1    107.74     107.77          0   27019892          0           0

------- ------  -------- ---------- ---------- ---------- ----------  ----------

total        3    107.75     107.77          0   27019892          0           0


Misses in library cache during parse: 1


Elapsed times include waiting on following events:

  Event waited on                             Times   Max. Wait  Total Waited

  ----------------------------------------   Waited  ----------  ------------

  SQL*Net message to client                       2        0.00          0.00

  SQL*Net message from client                     2       16.50         27.35

  SQL*Net break/reset to client                   1        0.00          0.00



OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS


call     count       cpu    elapsed       disk      query    current        rows

------- ------  -------- ---------- ---------- ---------- ----------  ----------

Parse        0      0.00       0.00          0          0          0           0

Execute      0      0.00       0.00          0          0          0           0

Fetch        0      0.00       0.00          0          0          0           0

------- ------  -------- ---------- ---------- ---------- ----------  ----------

total        0      0.00       0.00          0          0          0           0


Misses in library cache during parse: 0


    1  user  SQL statements in session.

    0  internal SQL statements in session.

    1  SQL statements in session.

********************************************************************************

Trace file: orcl_ora_24840.trc

Trace file compatibility: 11.1.0.7

Sort options: default


       1  session in tracefile.

       1  user  SQL statements in trace file.

       0  internal SQL statements in trace file.

       1  SQL statements in trace file.

       1  unique SQL statements in trace file.

      71  lines in trace file.

     107  elapsed seconds in trace file.

explain执行计划:

PLAN_TABLE_OUTPUT

------------------------------------------------------------------------------------------------------------------------

Plan hash value: 2121402856


-----------------------------------------------------------------------------------------------------

| Id  | Operation                     | Name                | Rows  | Bytes | Cost (%CPU)| Time     |

-----------------------------------------------------------------------------------------------------

|   0 | SELECT STATEMENT              |                     |     1 |    64 |     0   (0)| 00:00:01 |

|   1 |  SORT AGGREGATE               |                     |     1 |    64 |            |          |

|   2 |   NESTED LOOPS SEMI           |                     |     1 |    64 |     0   (0)| 00:00:01 |

|   3 |    TABLE ACCESS BY INDEX ROWID| CS_MT_BAK_TWO       |     1 |    30 |     0   (0)| 00:00:01 |

|*  4 |     INDEX RANGE SCAN          | IDX_MT_TWO_REQUEST  |     1 |       |     0   (0)| 00:00:01 |

|*  5 |    TABLE ACCESS BY INDEX ROWID| CS_RESP_TWO         |     1 |    34 |     0   (0)| 00:00:01 |


PLAN_TABLE_OUTPUT

------------------------------------------------------------------------------------------------------------------------

|*  6 |     INDEX RANGE SCAN          | IDX_RESP_TWO_RESULT |     1 |       |     0   (0)| 00:00:01 |

-----------------------------------------------------------------------------------------------------


Predicate Information (identified by operation id):

---------------------------------------------------


   4 - access("A"."REQUEST_TIME">=TO_DATE(' 2019-08-16 00:00:00', 'syyyy-mm-dd hh24:mi:ss')

              AND "A"."REQUEST_TIME"<=TO_DATE(' 2019-08-16 23:59:59', 'syyyy-mm-dd hh24:mi:ss'))

   5 - filter("A"."ID"="MID")

   6 - access("RESULT"=100)


21 rows selected.


收藏
分享
3条回答
默认
最新
文成

试试下面的查询

select count(1)
  from gdhysms.cs_mt_bak_two a,gdhysms.cs_resp_two b
 WHERE 1 = 1
   and b.result = 100 
   and a.id=b.mid
   and a.request_time >=to_date('2019-08-16 00:00:00','yyyy-MM-dd hh24:mi:ss') 
   and a.request_time <= to_date('2019-08-16 23:59:59','yyyy-MM-dd hh24:mi:ss')
复制


暂无图片 评论
暂无图片 有用 0
打赏 0
tianhy

谢谢大师,这里只第一次查询出结果了,后面在执行就不出结果,相关的进程cpu使用率也还是上升,机器环境描述有点问题,这里是ogg的目标端、dg主库

暂无图片 评论
暂无图片 有用 0
打赏 0
tianhy
问题已关闭: 问题已经得到解决
暂无图片 评论
暂无图片 有用 0
打赏 0
回答交流
Markdown


请输入正文
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏