mardi 5 janvier 2016

set a maximum time on execution of PL/SQL script

I am trying to do some performance load testing on some tables in our DB. The method we are using is basically a script that loops insert statements. However, we want to know how many inserts a minute the system can handle. Currently, my scripts looks like such:

set serveroutput on
variable n number
exec :n := dbms_utility.get_time
begin 
for i in 1..5000 loop
insert into aoms.buyers (user_id,buyer_cd,buyer_eng_nm,reg_dt)
values(dbms_random.string('L',8),'LT0','LT04','LT05');
end loop;
end;
/
exec :n := (dbms_utility.get_time - :n)/100
exec dbms_output.put_line(:n) 

Instead of just having a timer on the script I would like to insert as many records in 60 seconds as possible. How can this be done? Additionally, If I wanted to make this script more dynamic in nature and be able to use it on different tables with different structures (column names, primary keys) how would I go about that. Is it possible? thanks.

Aucun commentaire:

Enregistrer un commentaire