1.插入语句语句是
- SQL code
insert into tb_aselect b.m,c.ntb_b bleft join tb_c c......where.....
这一类的语句,但是400多行的数据,需要插入很久,基本上是几分钟。
===========================================================
2.查询语句查询
- SQL code
--insert into tb_aselect b.m,c.ntb_b bleft join tb_c c......where.....
基本上是一秒内就出来
===========================================================
3.执行建表语句
- SQL code
--insert into tb_acreate table tb_a2 asselect b.m,c.ntb_b bleft join tb_c c......where.....
同样需要很久
===========================================================
tb_a为空表,无索引,无外键,无主键
请高手解答下
------解决方案--------------------
建议调整语法为:
inset into tb_a
select b.m,c.n
from tb_b b,tb_c
where b.id=c.id
查询时左连是不会影响速度,但是插入时就会明显的降低效率
------解决方案--------------------
与左连接没有关系
写数据慢,磁盘I0是不是有问题
------解决方案--------------------
有道理。
------解决方案--------------------
顶
插入和查询的方式是不一样的
------解决方案--------------------
你最好把要插入的那些数据放到一个临时表里面。再插入。。看下速度。。
------解决方案--------------------
磁盘空间是不是满了,自动扩展很慢造成的。
------解决方案--------------------
是很奇怪,400条数据写入要几分钟,如果只是IO问题,那IO得多慢啊。
------解决方案--------------------
------解决方案--------------------
确认一下你的table_a 是不是被别人锁定了
- SQL code
select * from v$session t1,v$locked_object t2,user_objects t3where t1.sid=t2.session_id and t2.object_id = t3.object_id;--因为 当表A被人锁定后,别人是不能插入数据的,除非那人解锁--你可以试试--1、加锁 排他锁 和 共享锁 都可以lock table table_a in Exclusive mode; --排他锁lock table table_a in share mode; --共享锁--2、新打开一个窗口执行插入,这个窗口会挂住,除非你在第一个窗口 commit 和 rollback 解锁。
------解决方案--------------------
insert into/*APPEND*/ tb_a NOLOGGING
select b.m,c.n
tb_b b
left join
tb_c c
......
where
.....
------解决方案--------------------
insert into/*APPEND*/ tb_a NOLOGGING
select b.m,c.n
tb_b b
left join
tb_c c
......
where
.....
------解决方案--------------------
------解决方案--------------------
都不看等待事件的吗?
------解决方案--------------------
楼上说的对,先看下等待时间吧!