Thursday, November 28, 2013

PeopleSoft Performance Tune-Up Tips

2. Use Array Record object for sequential insertion instead of Record Object with Insert function

for example consider the below code,

Local Record &rUserEmail;
&rUserEmail = createrecord(record.XX_USER_EMAIL);
&rUserEmail.EMPLID.Value = '86948';
&rUserEmail.EMAILID.Value = 'Support.hello@yahoo.com';
&rUserEmail.Insert();
&rUserEmail.EMPLID.Value = '47393';
&rUserEmail.EMAILID.Value = 'support.youone@yahoo.com';
&rUserEmail.Insert();
...
...


and the same code can be written by using the Array Record object.

local array &aryUserEmail;
&aryUserEmail = createArray();
&aryUserEmail.push(createRecord(record.XX_USER_EMAIL));
&aryUserEmail[1].EMPLID.value = '2383';
&aryUserEmail[1].EMAILID.value = 'support.welcome@yahoo.com';
...
...
&SQL = CreateSQL("insert into %table(XX_USER_EMAIL) (EMPLID, EMAILID) values (:1,:2)");
&SQL.BulkMode = true;
for &i=1 to &noOfEmails
   &SQL.execute(&aryUserEmail[&i].EMPLID.value, &aryUserEmail[&i].EMAILID.value);
end-for;

Tuesday, November 26, 2013

PeopleSoft Performance Tune-Up Tips

1. Use RowSet Fill instead of using SQL Objects Fetch mehod

For example see the below code which is written with SQL Object with fetch

local SQL &sqlOprDefn;
&sqlOprDefn = createSQL("select oprid, oprdefndesc, emailid from PSOPRDEFN where emailid <> ' ' ");

while (&sqlOprDefn.fetch(&id, &name, &email))
    ...do some operations...
end-while;


and the same code can be written as below using Rowset Fill method

local rowset &rsOprDefn;
&rsOprDefn = createrowset(record.PSOPRDEFN);
&rsOprDefn.fill("where emailid <> ' ' ");

for &i = 1 to &rsOprDefn.ActiveRowCount
s&id = rsOprDefn[&i].OPRID.value;
s&name = rsOprDefn[&i].OPRDEFNDESC.value;
s&emailid = rsOprDefn[&i].EMAILID.value;
    ...do some operations...
end-for;

when you do like this, you see dramatically the performance improved.