数据库中有一个表,数据量不过也就600来条数据,但是对表进行插入和查询的时候相当慢。我truncate table mytable,将高水位线置零后,还是比较慢。不知道什么原因。我在对数据进行插入的时候看了一下,估计是2秒钟插入一条数据。用select * from M_MID_BUSI_MAIN_PRO_INCO_MONI where BAL_M < 0查询的时候,估计要10多秒。不知道什么原因,望高手指点。
首先感谢各位的及时响应,我看了一下执行计划,如贴图,我对这个执行计划没有怎么深入了解,麻烦给我给我看看这个执行计划有没有问题 explain plan for select * from M_MID_BUSI_MAIN_PRO_INCO_MONI where BAL_M < 0 select * from table(dbms_xplan.display); 返回结果: Plan hash value: 2780848249--------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | --------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 60 | 644K (2)| 02:08:50 | |* 1 | TABLE ACCESS FULL| M_MID_BUSI_MAIN_PRO_INCO_MONI | 1 | 60 | 644K (2)| 02:08:50 | --------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - filter("BAL_M"<0)
create table tablename_bak as (select * from tablename); truncate table tablename; insert into tablename (select * from tablename_bak); drop table tablename_bak; alter index index_name rebuild;
1。 数据库性能怎么样?
2。 把表删了,在重新创建一下看看..------------------------------------------------------------------------------
Blog: http://blog.csdn.net/tianlesoftware
网上资源: http://tianlesoftware.download.csdn.net
相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx
Q Q 群:62697716
explain plan for
select * from M_MID_BUSI_MAIN_PRO_INCO_MONI where BAL_M < 0
select * from table(dbms_xplan.display);
返回结果:
Plan hash value: 2780848249---------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 60 | 644K (2)| 02:08:50 |
|* 1 | TABLE ACCESS FULL| M_MID_BUSI_MAIN_PRO_INCO_MONI | 1 | 60 | 644K (2)| 02:08:50 |
---------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("BAL_M"<0)
truncate table tablename;
insert into tablename (select * from tablename_bak);
drop table tablename_bak;
alter index index_name rebuild;
在job里面的insert语句后面加上commit看看?