We have to periodically copy data from the main database to an auxiliary database. I have the following procedure in the auxiliary db side:
procedure p_proc(start_date DATE, end_date DATE := sysdate) as
begin
insert into foo select /*+DRIVING_SITE(f) PARALLEL(8)*/ f.*
from remote_foo f
where f.tsp >= start_date and f.tsp < end_date;
insert into foo_c1 select /*+DRIVING_SITE(f) PARALLEL(8)*/ c.*
from remote_foo_c1 c join remote_foo f
on c.fk = f.pk
where f.tsp >= start_date and f.tsp < end_date;
--13 more child tables
commit;
end;
On average of 7million records for the main table (foo), it takes like 20min.
Are there more improvements that I could apply apart from the parallelism and the driving site hints?
Explain plan for the 2nd query (foo_c1): https://pastebin.com/raw/79GWjj19
All the fields used in the filter have indexes, on both sides. Oracle 19c (19.11.0.0.0).