Working with database views for reporting
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.
- If ACLs exist on the database view itself, those ACLs are evaluated and take precedence.
- If no database view ACLs exist, the system honors ACLs from the underlying tables.
- 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 don't need to create ACLs on fields in the view. If field-level ACLs exist, the system evaluates them.
To require that 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.
When glide.security.expander.view.legacy is true, underlying table ACLs are ignored. When the property is false (the default), the underlying table ACLs are used if there are no database view ACLs.
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.