--인덱스 생성 전 버퍼의 갯수 : 31134
SELECT /*+ leading(t s) use_nl(s) */ t.calendar_year,sum(amount_sold)
from sales200 s, times200 t
where s.time_id = t.time_id
and t.week_ending_day_id = 1582
group by t.calendar_year;
SELECT * FROM TABLE(dbms_xplan.display_cursor(null,null,'ALLSTATS LAST'));
-- 인덱스 생성 후 버퍼의 갯수 : 312 개
create index s_time_id on sales200(time_id);
create index t_time_id on times200(time_id);
SELECT /*+ leading(t s) use_nl(s) */ t.calendar_year,sum(amount_sold)
from sales200 s, times200 t
where s.time_id = t.time_id
and t.week_ending_day_id = 1582
group by t.calendar_year;
SELECT * FROM TABLE(dbms_xplan.display_cursor(null,null,'ALLSTATS LAST'));