create table base_table
as
select object_type, object_name
from all_objects
;


create table mv_table
as
select object_type, count(*) ct
from all_objects
group by object_type
;


create materialized view mv_table
on prebuilt table
never refresh
enable query rewrite
as
select object_type, count(*) ct
from base_table
group by object_type
;

analyze table base_table compute statistics;
analyze table mv_table compute statistics;

alter session set query_rewrite_enabled=true;
alter session set query_rewrite_integrity=trusted;

set autotrace traceonly explain;

select object_type, count(*) 
from
	base_TABLE
group by object_type
;

select object_type, count(*)
from
	bAsE_tAbLe
group by object_type
;

select object_type, count(*)
from
	base_table
group by object_type
;

select count(*) 
from base_table
;

