- 最后登录
- 2014-7-2
- 在线时间
- 6 小时
- 威望
- 3
- 金钱
- 42
- 注册时间
- 2012-6-24
- 阅读权限
- 10
- 帖子
- 17
- 精华
- 0
- 积分
- 3
- UID
- 527
|
1#
发表于 2013-7-31 15:45:37
|
查看: 3825 |
回复: 17
版本:
SMS2@gstgate>select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
情况1:
SMS2@gstgate>explain plan for SELECT seq_id, status
2 FROM g_sgip_send_phone
3 WHERE recv_time >= to_date('2013-07-28 11:37:31', 'yyyy-mm-dd hh24:mi:ss')
4 AND recv_time <= to_date('2013-07-28 11:37:33', 'yyyy-mm-dd hh24:mi:ss')
5 AND to_phone = '8613000000000';
Explained.
执行计划如下:
SMS2@gstgate>select * from table(dbms_xplan.display());
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------
Plan hash value: 3827887301
---------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 32 | 16398 (1)| 00:03:17 |
|* 1 | TABLE ACCESS FULL| G_SGIP_SEND_PHONE | 1 | 32 | 16398 (1)| 00:03:17 |
---------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------
1 - filter("TO_PHONE"='8613000000000' AND "RECV_TIME"<=TO_DATE(' 2013-07-28
11:37:33', 'syyyy-mm-dd hh24:mi:ss') AND "RECV_TIME">=TO_DATE(' 2013-07-28
11:37:31', 'syyyy-mm-dd hh24:mi:ss'))
15 rows selected.
执行结果:
SMS2@gstgate> SELECT seq_id, status
2 FROM g_sgip_send_phone
WHERE recv_time >= to_date('2013-07-28 11:37:31', 'yyyy-mm-dd hh24:mi:ss')
AND recv_time <= to_date('2013-07-28 11:37:33', 'yyyy-mm-dd hh24:mi:ss')
5 AND to_phone = '8613000000000';
SEQ_ID STATUS
---------- ----------
323125039 12
情况2:
SMS2@gstgate>explain plan for SELECT seq_id,seq_id,seq_id,report_time, status
2 FROM g_sgip_send_phone
3 WHERE recv_time >= to_date('2013-07-28 11:37:31', 'yyyy-mm-dd hh24:mi:ss')
4 AND recv_time <= to_date('2013-07-28 11:37:33', 'yyyy-mm-dd hh24:mi:ss')
5 AND to_phone = '8613000000000';
Explained.
执行计划:
SMS2@gstgate>select * from table(dbms_xplan.display());
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------
Plan hash value: 3827887301
---------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 40 | 16398 (1)| 00:03:17 |
|* 1 | TABLE ACCESS FULL| G_SGIP_SEND_PHONE | 1 | 40 | 16398 (1)| 00:03:17 |
---------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------
1 - filter("TO_PHONE"='8613000000000' AND "RECV_TIME"<=TO_DATE(' 2013-07-28
11:37:33', 'syyyy-mm-dd hh24:mi:ss') AND "RECV_TIME">=TO_DATE(' 2013-07-28
11:37:31', 'syyyy-mm-dd hh24:mi:ss'))
15 rows selected.
执行结果:
SELECT seq_id,seq_id,seq_id,report_time, status
2 FROM g_sgip_send_phone
WHERE recv_time >= to_date('2013-07-28 11:37:31', 'yyyy-mm-dd hh24:mi:ss')
AND recv_time <= to_date('2013-07-28 11:37:33', 'yyyy-mm-dd hh24:mi:ss')
5 AND to_phone = '8613000000000';
SEQ_ID SEQ_ID SEQ_ID REPORT_TIME STATUS
---------- ---------- ---------- ------------------- ----------
2013-07-29 09:17:04 12 |
|