物化视图的效率

有两个表:人员表A001有10万数据,机构表B001有5千数据

建普通视图:

create or replace view test_v as
select * from A001 a ,B001 B where a.a001721=b.orguid

建一个物化视图

create MATERIALIZED view test_v_m as
 select * from A001 a ,B001 B where a.a001721=b.orguid

比较效率:

select * from test_v where A001001 like '%军%' or b001003 like '%001006%' or A001011 like '%1970%' ;用时10秒多

from test_v_m where A001001 like '%军%' or b001003 like '%001006%' or A001011 like '%1970%' ;用时0.125秒

对查询来说,物化视图的效率是普通视图的10/0.125=80倍;相当高啊!

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章