Oracle 的视图与索引
有表A(字段A1,A2)和表B(字段B1,B2).
字段A2,B2上都有索引.
A,B 表联查
sql1 这个sql 非常快 2秒的样子
select * from A,B where A.A1=B.B1(+) and A2='值1'
sql2 这个sql 慢到让人无法忍受
select * from A,B where A.A1=B.B1(+) and B2='值1'
外联以后 表B上的索引不起作用了.
如果换成内联 速度很快.
select * from A,B where A.A1=B.B1 and B2='值1'
1.物化视图
普通视图不可以建索引。物化视图可以建索引。
CREATE MATERIALIZED VIEW m_tb REFRESH WITH ROWID as select * from tb;
create index idx_tb on m_tb(col1);
2.用hint语句强制指定优化器类型
select /*+index(A,idx_a1) index(B,idx_b1)*/* from A,B where A.A1=B.B1(+) and B1='值1'
2010-02-16 16:04:51 BY TZC
相关文档:
Oracle JDeveloper 10g Release Download
Oracle JDeveloper 10g (version 9.0.5.1, build 1605) for Windows NT/2000/X, Linux, Solaris, and HP-UX.
http://download.oracle.com/otn/java/jdeveloper/905/jdev9051.zip
http://download-east.oracle.com/otn/java/jdeveloper/905/jdev9051.zip
http://download-west ......
select custid,carid,Cunote,INVNO,BUYPLAN
from ( select custid,carid,Cunote,INVNO,BUYPLAN,
row_number() over(partition by custid,carid order by Feedbackid desc) rn
from pvE3S.T_VCTM_CUSTOMER_FEEDBACK) t1 where rn=1
按Feedbackid 排序,rn是前N行 ......
Hey all,
Since there seems to be a fair bit of disinformation, and utter nonsense,
floating around since my talk at the Black Hat Federal security conference
the other day, I have decided to publish the following papers.
http://www.databasesecurity.com/HackingAurora.pdf
http://www.databasesec ......
程序包
包主体/规范名字一样
包主体/规范中的对应参数必须类型及名字一样
只能使用强类型的REF游标
创建程序包规范
create or replace package my_pack
is
procedure find_emp_proc(eno emp.empno%type);
function fin ......
触发器
q 触发器是当特定事件出现时自动执行的存储过程
q 特定事件可以是执行更新的DML语句和DDL语句
q 触发器不能被显式调用
q 触发器的功能:
q ......