Lower performance from réferenced catalog variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
We have a catalog variable type reference and we wrote
Ref qualifier: javascript:new SNCFWorkstationQualifier().getQualifier(current.variables.beneficiaireVAR); , Our Script include is :
getQualifier: function(beneficiaryId) {
if (gs.nil(beneficiaryId))
return 'sys_idISEMPTY';
// Offres Windows autorisées
var offerIds = gs.getProperty('sncf_windows_offers','');
if (gs.nil(offerIds))
return 'sys_idISEMPTY';
// Relations CI -> Offres Windows
var ciIds = [];
var relGR = new GlideRecord('cmdb_rel_ci');
relGR.addQuery('parent', 'IN', offerIds);
relGR.query();
while (relGR.next()) {
ciIds.push(relGR.getValue('child'));
}
if (ciIds.length === 0)
return 'sys_idISEMPTY';
// Encoded query finale
var query =
'sys_idIN' + ciIds.join(',') +
'^assigned_to=' + beneficiaryId +
'^install_status=1' +
'^asset.asset_function=individuel';
return query;
},And Attributes : ref_auto_completer=AJAXTableCompleter,ref_ac_columns=name,serial_number,ref_ac_order_by=name
However the performance of the variable when the user first click on it is 15 to 16 seconds before it shows a result i think we filter in a big table with lots of records, anoyones have an idea how to resolve this issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12m ago
Hello @MalikB ,
The performance issue is likely caused by the Script Include fetching a large number of records from the cmdb_rel_ci table and storing their child sys_ids in an array before generating the final sys_idIN query. Instead of retrieving all matching records, try optimizing the GlideRecord query to filter records as early as possible.The problem is not necessarily the reference variable itself. It is more likely the expensive database query and the large number of sys_ids being generated by the Script Include. Optimizing the query should be the first step before changing the catalog variable configuration. I would also recommend checking the query execution time and the number of records returned to identify the actual bottleneck before making changes.
If this helps you then mark it as helpful and accept as solution .
Regards,
Aditya
