Gliderecord and GlideAggregate

Abhinab Achary1
Tera Guru

Hi All,

I have a query.

currently in our system we have gliderecord in script which basically counts using getrowcount and also deletes junk records .

We want to usse glideagrregate to count, so this entire functionality using glideagrregate can this be achieved?

Thanks,

Abhinab

1 ACCEPTED SOLUTION

If you are deleting records, then there is no performance gained by using GlideAggregate. They are going to do the same thing in the end. The only performance gained is using GlideAggregate's count over GlideRecord's getRowCount() for simply count operations.



My recommendation is to use GlideRecord, getRowCount() to count the records and deleteRecord() to delete them in the same server side script. If you use GlideAggregate with deleteRecord(), you're going to confuse someone somewhere.


View solution in original post

16 REPLIES 16

How about useing gliderecors to delete using one object gr , and using glideagrregate GrAg for counting. will it make differnce ?


Like Chuck already mentioned, if you're using the count once, you're better with getRowCount() as your script will be easier to read and maintain.


How many records do you need to delete in general and how many times do you need to count?


Its a scheduled job and it will have atleast more number of records to cleanup knowledge artcile which are no longer using.


I don't know if I would delete the records. You might be better off setting the status to unpublished/retired so you still have the information, but not deleted and gone forever - just inaccessible to the masses.



Use delete VERY cautiously. There's really no penalty for keeping obsolete information around.


GlideAggregate is an extension of GlideRecord indeed so yes it supports same methods. The difference appears if you start adding Aggregate methods.