View only unique records in List view of the table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 06:50 AM
There are over 10,000,000 records in a custom table, out of which only 4400 records are unique. I am trying to create a query business rule that will display only those distinct records and filter out the duplicates.
Not able to achieve this. So far I have achieved this:
var osCount= [];
var records;
var gr = new GlideAggregate('u_softwares_on_windows_servers');
gr.addQuery("cmdbci_sys_class_name", "cmdb_ci_win_server");
gr.addQuery("cmdbci_operational_status", "1");
gr.addAggregate('count');
gr.orderByAggregate('count');
gr.groupBy('sp_sys_id');
gr.query();
while (gr.next()) {
osCount.push(gr.sp_sys_id.trim());
}
for (var i = 0; i < osCount.length; i++) {
return osCount[i];
}
- Labels:
-
Multiple Versions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 07:04 AM
Why don't you delete all the records which are not unique?
It makes no sense to implement a query business rule just for cutting out nearly 10 Million records. This will massively degrade the performance of your instance!
Kind regards
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 07:21 AM
It is a database view fetching records from cmdb tables, deleting won't solve the issue.