Performance issue on Advanced reference qualifier

Anil Karthik N
Tera Contributor

We have written one script include in global scope and calling it in Reference qualifier of Human resource:core scope.

We have one field referencing to user table in which we have reference qualifier to advanced from that we are calling script include. when we search its taking almost 3 to 4 minutes to get the users into the reference field.

 

Currently we have 60k records in the HR profile table.

 

below is my code:

 

getUsers: function() {

        var arr = [];

        var grManager = new GlideAggregate("sn_hr_core_profile");

        grManager.addEncodedQuery('u_employment_statusNOT LIKETerminated');

        grManager.query();

        while (grManager.next()) {

            arr.push(grManager.user.toString());

        }

       

        return 'sys_idIN' + arr;

       

    },

reference:

javascript: new scriptIncludeName().getUsers()

5 REPLIES 5

Siddhesh Gawade
Mega Sage
Mega Sage

Hello @Anil Karthik N ,

 

You can check if there are any query business rules present on sys_user table which can cause this slowness.

 

Also you can try creating indexes for "u_employment_status" field used in your encoded query which can help you to improve query response for your script.

Check out this for better understanding: What is a database index and how to create one 

 

Kindly mark the answer ✔️ Correct or Helpful ✔️ If it addresses your concern.


Regards,

Siddhesh