Benoit Crestey
ServiceNow Employee
ServiceNow Employee

You should read this article if :

  • You are an admin
  • You want to understand if Table Cleaner is working well and if something might be stuck

 

What is Table Cleaner?

 

How to debug Table Cleaner?

  • Sadfuly OOB logs are not very easy to read. You can :
    • Look sys_auto_flush table for definitions
    • Look sys_auto_flush_run table for duration of last runs, and when it runned last time
    • Look syslog for duration of last runs, and when it runned last time
    • Look transactions logs to check if Table Cleaner runned, when, and for how long
    • Look sys_trigger to see if the job is running or nor
  • My tool in allows to do the same, but in an easy way

 

How to use the Tool

  • I created a menu to access the UI page :

BenoitCrestey_0-1699957061454.png

 

Example part 1 : sys_auto_flush Definitions

  • To check the Table Cleaner Configuration

BenoitCrestey_0-1699958239278.png

  • On this example you can see :
    • cmdb_metric : Definition is configured to delete data in a table that doesn't exist (it will be ignored)
    • All defincitions : Query time seems OK
    • em_impact_graph : Cleanup of this table is possibly late (please note it can be normal as the job runs every hour only)

 

Example part 2 : Schedule Jobs

  • To check if Table Cleaner did run properly
  • Example 1 : All is very fast

BenoitCrestey_4-1699957752413.png

  • Example 2 : OK, but long :

BenoitCrestey_2-1699957396071.png

  • Example 3 : Job took a long time to run, it is not normal
    • Job will be late, impact on performance may occur

BenoitCrestey_3-1699957488210.png

 

Example part 3 : Tables taking a lot of time to clean, from Logs

  • To check if Table Cleaner did have enough time to clean the tables
  • On the following example, we can see em_impact_graph is very long to process :

BenoitCrestey_1-1699957324259.png

 

 

How to deploy

  • As an admin, download and install the attached Update Set on your instance :
    • Download
    • Navigate to System Update Sets > Retrieved Update Sets.
    • Click the Import Update Set from XML link
    • Select the downloaded file and Upload
    • Open the Update Set
    • Click Preview Update Set
    • Click Commit Update Set
    • Reload the menus, it is possible that you have to relog to see it

 

Example of typical findings you might spot

  • Issue : Table Cleaner rule that is querying an index attribute
    • Possible solutions : change indexes, change query, reduce time window to clean, find alternative ways to clean, remove auditing (removed data can be saved, slowing a lot the process)
  • Issue : Table clean definition table or query is wrong
  • Issue : A defintion is not cleaning as an other is taking all the time
Comments
KerriF
Tera Explorer

@Benoit Crestey  this is very helpful! 

 

Within HR Service Delivery, we are required to retain certain records where there is a legal hold, captured in a true/false flag that sits in our HR Profile (direct feed from our HR system). Currently, our table cleaner for User Profiles does not pick up this legal hold flag.  We will be going back to development of table cleaner to determine how to skip records that have legal hold in HR Profile.

 

Any other organizations have done this work to ensure that legal hold is skipped from table cleaner?

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hello @Benoit Crestey 

Thank you for the article.

Just a query, Will the cascade delete option override the effects of disabling the 'Clean Peripheral' functionality.?

Meaning if I uncheck clean peripheral to keep my attachments and if I check cascade delete, my attachments still get deleted?

 

Kind Regards, 

Ravi 

 

Version history
Last update:
‎11-14-2023 03:20 AM
Updated by:
Contributors