I am writing a query to calculate some values and save them onto a table on a periodic basis. The values I needs are being returned from a function call.
These values need to be saved on to a table, and I have a dbms schedule job to insert these to a table. The job executes the following;
BEGIN
execute immediate 'truncate table tbl1';
INSERT /*+ append*/ INTO tbl1(v1, v2, v3, v4)
SELECT
function1(input),
function2(input),
function3(input),
SYSDATE
FROM tbl;
END;
The scheduled jobs runs for over 8 hours, for over 500k records! I understand the logic int he functions are time consuming, and there is the context switching in selecting from functions. Is there another way for me to achieve this, with better performance?
I am on Oracle 12c. Are there any suggestions on how I can make this job run faster?