oracle 静态视图 物化视图
时间:2022-03-10 17:06
SQL> select * from v$version;
SQL> create materialized view mv_testcf
SQL> analyze table xiaotg.mv_testcf compute statistics;
SQL> select tl.table_name, tl.num_rows from user_tables tl where tl.table_name in ( ‘TESTCF‘, ‘MV_TESTCF‘ );
SQL> col segment_name for a24
OWNERXIAOTG
SQL> insert into xiaotg.testcf
SQL> select * from xiaotg.testcf t where t.id = 80001 ;
SQL> analyze table xiaotg.mv_testcf2 compute statistics;
SQL> select tl.table_name, tl.num_rows from user_tables tl where tl.table_name in ( ‘TESTCF‘, ‘MV_TESTCF2‘ );
SQL> select mv.* from user_mviews mv where mv.MVIEW_NAME = ‘MV_TESTCF‘;
SQL> drop materialized view mv_testcf2;
Materialized view dropped
Executed in 1.984 seconds
SQL>
SQL>
SQL> insert into xiaotg.testcf ( id, name ) values ( 80003, ‘ xiaotg again he he 3 ‘);
1 row inserted
Executed in 0 seconds
SQL> commit;
Commit complete
Executed in 0 seconds
SQL> create materialized view mv_testcf
SQL> analyze table xiaotg.mv_testcf compute statistics;
SQL> select tl.table_name, tl.num_rows from user_tables tl where tl.table_name in ( ‘TESTCF‘, ‘MV_TESTCF‘ );
SQL> col segment_name for a24
OWNERXIAOTG
SQL> insert into xiaotg.testcf
SQL> select * from xiaotg.testcf t where t.id = 80001 ;
SQL> analyze table xiaotg.mv_testcf2 compute statistics;
SQL> select tl.table_name, tl.num_rows from user_tables tl where tl.table_name in ( ‘TESTCF‘, ‘MV_TESTCF2‘ );
SQL> select mv.* from user_mviews mv where mv.MVIEW_NAME = ‘MV_TESTCF‘;
REFRESH_MODECOMMIT
SQL> drop materialized view mv_testcf2;
Materialized view dropped
Executed in 1.984 seconds
SQL>
SQL>
SQL> insert into xiaotg.testcf ( id, name ) values ( 80003, ‘ xiaotg again he he 3 ‘);
1 row inserted
Executed in 0 seconds
SQL> commit;
Commit complete
Executed in 0 seconds
oracle 静态视图 物化视图,布布扣,bubuko.com