I need to move data between to schemas. I have a created packaged code to accomplish this. The problem is the execution time. When running the insert statements from the source schema to insert data into the target schema, it takes considerably longer to complete the statement than if I copied the tables from the source schema into the target schema and executed the same statement in the target schema. Any insight as to why this might be?
Thanks in advance
Here is a sample of one of the insert statements:
INSERT INTO target_table(tt_id, tt_disp, tt_date, tt_emp_1, tt_emp_2, tt_emp_3)
SELECT src_tab.src_id,
src_tab.scr_disp,
src_tab.scr_date,
src_tab.scr_emp_1,
src_tab.scr_emp_2,
src_tab.scr_emp_3
FROM
(SELECT row_number() over(
ORDER BY SUBSTR(fn_cil_sort_format(SUBSTR(src_cil,
1, 8)), 1, 4), SUBSTR(src_cil, 4, 8)) AS src_id,
scr_disp,
fn_date_format(date_time) AS scr_date,
v_convert AS scr_emp_1,
v_convert AS scr_emp_2,
v_convert AS scr_emp_3
FROM source_table
ORDER BY SUBSTR(fn_sort_format(SUBSTR(src_cil, 1,
8)), 1, 4), SUBSTR(src_cil, 4, 8)) src_tab
WHERE scr_disp IS NOT NULL;
You might want to check out this Fast Guide to PL/SQL. It outlines several methods of performance tuning, and links to several resources on the subject.
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!
Discuss This Question: 3  Replies