Working with database views for reporting

  • Release version: Yokohama
  • Updated August 7, 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 Working with database views for reporting

    Database views in ServiceNow define table joins specifically for reporting purposes, enabling customers to consolidate data from multiple tables into a single view. For example, a view can join Incident, Metric Definition, and Metric Instance tables to facilitate comprehensive incident metric reporting. These views allow inclusion of fields from any joined tables and can be used directly as report sources by any user with report creation permissions, while respecting ACLs on the underlying tables.

    Show full answer Show less

    Key Features

    • Pre-built database views are available via the Database View and Database Views for Service Management plugins, covering most metric reporting needs and minimizing the need for custom views.
    • Database views honor ACLs on underlying tables, including parent table ACLs, ensuring secure access control.
    • Performance optimization is critical; using indexed fields in ‘where’ clauses improves query efficiency as performance impact grows with more tables and records involved.
    • Database views do not impose licensing costs as they are not treated as custom tables and are excluded from FTP exports.
    • Function fields can be added to views to enhance output with computed results, and complex queries can leverage conjunctions and disjunctions logically.

    Limitations and Important Considerations

    • Database views cannot be created on tables that are part of table rotation.
    • Data cannot be edited directly through database views—they are read-only.
    • Database views cannot be used as data preservers in clone requests.
    • Cross-application scope referencing is allowed except when involving tables extending sysmetadata, which must belong to the same scope.
    • Explicit ACLs on fields in views are not required as ACLs on underlying tables are enforced; however, setting the system property glide.security.expander.view.legacy to true enforces read ACLs on views themselves in upgraded instances.
    • Using reserved words in database views may cause performance issues; customers should avoid MySQL reserved words.

    Practical Application for ServiceNow Customers

    ServiceNow customers can leverage database views to streamline complex reporting requirements by joining multiple tables efficiently without creating custom tables. Pre-installed views via plugins provide immediate value for metric reporting. Customers should be mindful of performance considerations by using indexed fields and understand that views are read-only and subject to existing ACLs for security compliance. Proper configuration of ACLs and awareness of system properties ensure access control is maintained effectively.

    A database view defines table joins for reporting purposes.

    For example, a database view can join the Incident table to the Metric Definition and Metric Instance tables. This view can be used to report on incident metrics and may include fields from any of these three tables.

    Several useful database views are installed with the Database View plugin and the Database Views for Service Management plugin. These database views cover most metric reporting needs and greatly reduce the need to define new ones.

    Any user who can create a report can use database views as the report source, but ACLs on the underlying tables are honored. This means that the ACLs of the parent tables of those tables are also evaluated.

    Note:
    • The accumulated impact on performance grows as the number of tables that are included in the view and the number of records that those tables contain increases. To maximize the performance of the database view, ensure that the ‘where’ clauses that are defined in the database view are based on indexed fields.
    • A database view is not treated like a custom table, so there is no licensing impact.
    • Database view tables are not included in FTP exports.
    • Database views evaluate the ACLs of the parent table of a table included in the database view.

    Limitations

    • Database views cannot be created on tables that participate in table rotation.
    • It is not possible to edit data in the database view output.
    • Database view tables cannot be added as a data preserver in clone requests.
    • You can reference a table or database view from a different application scope in a Table Name field. However, if the field belongs to a table that extends sys_metadata, the table or database view must belong to the same application scope as that table.

    ACLs and database views

    You do not need to create ACLs on fields in the view. The system honors contextual ACLs (ACLs with a condition or script) that exist on the underlying table. Non-contextual ACLs (ACLs with only role checks) are still honored just as with previous releases.

    To require explicit read ACLs be added to the database views, set the glide.security.expander.view.legacy property to true. On upgraded instances, add this system property and set it to true.

    You can still create additional ACLs on the database views. These ACLs are evaluated last and are always honored.

    Database view reserved words

    Using the terms may cause unintended or undesirable performance. For more information, see the MySQL reserved words document.