Stats Tools

  • Release version: Zurich
  • Updated July 31, 2025
  • 2 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Stats Tools

    The Stats Tools in ServiceNow Zurich release help evaluate system performance by recording statistics on key activities such as query execution, script processing, and transactions. This plugin is enabled by default and requires admin role privileges for activation or upgrades. It provides diagnostic insights through modules like Slow Queries, Slow Scripts, and Slow Transactions accessible under System Diagnostics > Stats.

    Show full answer Show less

    Key Features

    • Activity Pattern Aggregation: Stats Tools collects and aggregates unique activity executions over time into pattern tables ([sysquerypattern], [sysscriptpattern], [systransactionpattern]). Each pattern record includes timing metrics and example execution details for analysis.
    • Filtering by Application Scope: Logs can be filtered to focus on transactions originating from specific application scopes, aiding targeted debugging.
    • Cache Management: Activity data is first cached before persistence; flushing server caches clears unpersisted activity records.
    • Metrics Collection: For each unique activity, total and average execution times along with execution counts are tracked and updated continuously.
    • Detailed Metadata: Example execution data is stored with each pattern record to help identify specific characteristics of performance issues.

    Characterizations of Activity Types

    • Transactions: Includes both server-side and related client-side transactions. Metrics such as total server load time are aggregated. Transactions are identified by URL, transaction type, processor, form/list actions, or thread name depending on the type.
    • Scripts: Covers scripts evaluated by GlideScopedEvaluator. Jelly Scripts are identified by file path and line number, while other scripts use table and sysid references.
    • Queries: Encompasses all prepared database statements executed by GlideDBI. Queries are identified by MongoDB operations or SQL-like statements including clauses, selected columns, and limits.

    Practical Benefits for ServiceNow Customers

    By leveraging Stats Tools, customers can proactively monitor and diagnose performance bottlenecks related to slow queries, scripts, and transactions. The aggregation of detailed timing metrics and execution metadata facilitates informed troubleshooting and optimization efforts, improving overall system responsiveness and reliability.

    To aid in performance evaluation, the Stats Tools records statistics for system activities that affect performance such as the execution of queries, scripts, and transactions.

    Note:
    The Stats Tools plugin is activated by default. It requires the admin role to activate or upgrade, and it requires the com.snc.jrobin.
    Stats Tools adds modules under System Diagnostics > Stats, including Slow Queries, Slow Scripts, and Slow Transactions. Each module accesses a table of activity patterns [sys_query_pattern], [sys_script_pattern], [sys_transaction_pattern]. Each pattern table represents a collection of unique activities. Each collection is an aggregation of executions of that unique activity over all time. Each record provides basic timing analysis with example identifiable details of the activity.
    Note:
    To aid in debugging, you can filter most of these logs by application scope, limiting the transactions (for example, slow scripts or events) to only those transactions originating in specific scopes.

    Activity patterns are immediately recorded to a cache and are later persisted to their pattern table. If you flush server caches, then recorded activities that have not been persisted are cleared. The following are examples of pattern records.

    • Each time a query is executed that meets the recording and persistence threshold it is aggregated and stored as a query pattern record.
    • Each time a particular business rule is executed it aggregates to a script pattern record.
    • Each time a particular background job runs it aggregates into a unique transaction pattern record.
    • Each click of the New button on the Incidents list counts as a list type transaction pattern with specific form action.

    Metrics

    Metrics include total and average times of interest per unique execution pattern over the total execution count. Metrics are aggregated with each new instance of the unique activity and persisted to the pattern record.

    Metadata

    Example data from specific executions are included on each pattern to identify execution details.

    Characterizations of each activity type

    Table 1.
    Transactions

    Any transaction type includes server-side and related client-side transactions.

    Metrics include Total server load time, which aggregates the total server-side time excluding semaphore and session wait times. It also aggregates relevant server transaction times that are found on the syslog_transaction table.

    Transaction types:

    • An HTTP Request transaction is identified by a URL, transaction type, processor, form/list action, URL query (filters), and related table name.
    • Any other transaction is identified by its transaction URL/page/name, transaction type, and processor or thread name.
    Scripts

    Any script activity type includes scripts evaluated by GlideScopedEvaluator.

    Script Types:

    • A Jelly Script is identified by the sys_jelly_file table, jelly file path, line number, and script that was executed.
    • Any other script is identified by the table and sys_id.
    Queries

    Any query activity includes prepared statements executed by GlideDBI.

    Query Types:

    All queries are identified by MongoDB query or insert, update, or select statements, as well as other components of the statement like selected columns, where clause, unions, column sets, and limits.