Each Table row count want to see in one location

Manohararuna
Tera Contributor

Hello Everyone,

 

       I want to one requirement . I have total 5000 table in my Org. In those few table are having the almost 5 lakhs more records and those table taking the more than 30 seconds time taking at the time of opening.

       1. So to checking each table how time taken (mean browsing time) want to see one location like dashboard level

       2.This dashbaord will show us to each table having how many records and how much browsing time taking at the time of opening

         3.want to see each table having the how many records.

      4.Number of Records field is not available in Table list view. is it possible to create new filed on table list and to row count on each table

 

 

 

 

1 ACCEPTED SOLUTION

SumanthDosapati
Mega Sage
Mega Sage

@Manohararuna 

There is no OOB table which directly stores those details.

  1. For number of records in each table, you can run a background script to get row count for each table but cannot create a report. If you definitely want a report then you need to create a custom table and feed the bg script data into that table and then create a report on that custom table.
  2. For load time of each list view, again there is no OOB table that directly stores that data. May be you can check the syslog_transaction table and apply the appropriate filters to get some data.

Accept the solution and mark as helpful if it does, to benefit future readers.
Regards,
Sumanth

View solution in original post

2 REPLIES 2

SumanthDosapati
Mega Sage
Mega Sage

@Manohararuna 

There is no OOB table which directly stores those details.

  1. For number of records in each table, you can run a background script to get row count for each table but cannot create a report. If you definitely want a report then you need to create a custom table and feed the bg script data into that table and then create a report on that custom table.
  2. For load time of each list view, again there is no OOB table that directly stores that data. May be you can check the syslog_transaction table and apply the appropriate filters to get some data.

Accept the solution and mark as helpful if it does, to benefit future readers.
Regards,
Sumanth

anand-bhosle
Tera Guru

Hi @Manohararuna

You can’t natively see “record count” or “average form-load time” for every table in the out-of-the-box Tables list. This is very unique requirement challenge, but you can build a simple end-to-end solution, let me draft you some points.

  1. Capture Record Counts

    • Use System Diagnostics ▶ Stats ▶ Table Statistics (or query sys_db_object) to get table names and row counts.

    • To make it easy to report on, build a scheduled script that loops every night through sys_db_object, does a GlideAggregate count on each table, and writes the results into a custom table (e.g. u_table_stats with fields u_table_name and u_row_count).

  2. Capture “Browse” (Form-Load) Times

    • Activate the UI Performance plugin so ServiceNow logs every form-load event into sys_metric_instance (look for event types like form_load).

    • In your scheduled script (or a second one), query sys_metric_instance for the past day’s loads per table, calculate the average load time, and store that on your same u_table_stats record (e.g. u_avg_load_ms).

  3. Build a Dashboard

    • Create a Performance Analytics (if licensed) or a plain Dashboard with two list/widgets pointed at your u_table_stats table:

      • One showing Table Name → Row Count → Avg Load Time, sortable by any column.

      • Another highlighting any table whose average load time exceeds your threshold (e.g. 5 sec).

  4. (Optional) Surface Row Count in the Out-of-the-Box Tables List

    • You cannot add a persistent physical field onto the sys_db_object table without risking upgrade conflicts. Instead, add a UI Macro column (via a List Decoration) that calls a tiny script include to look up u_table_stats.u_row_count for each row—and display that in the list.

Once you have that in place, you’ll have a single place where you can see, for all 5,000 tables, how big they are and how long they take users to open. That drives data-driven clean-up (archive old records, add indexes) and lets you prove performance improvements over time. Hope this helps.

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Anand