Understanding Redshift System Tables: Made Easy

Teniola Fatunmbi • Last Modified: December 29th, 2022

Understanding Redshift System Tables: Made Easy | Cover

Amazon Redshift has a lot of general concepts and in-house functions that provide its users with the privilege of performing analysis on data in real-time. Although Redshift’s main purpose is for Online Analytical Processing(OLAP), the functions it provides are not limited to business intelligence(BI) operations. Redshift’s functions include system administration and monitoring for administrative database users to control and diagnose Redshift’s clusters. How does Redshift store the data for system monitoring? – Redshift System tables!

In this article, you would learn about Redshift system tables and views, the functions they perform, and user access to them.

Table of Contents

  1. What are Redshift System Tables?
  2. What are Redshift System Views?
  3. Types of Redshift System Tables and Views
  4. Data Visibility and Manipulation in Redshift System Tables and Views
  5. Conclusion

What are Redshift System Tables?

System tables are tables that contain information on how the system is functioning in a structured format. They exhibit the same properties as traditional tables in terms of data querying and retrieval. The major difference is in the type of data they store and also the nature of the data stored.

However, some system tables can only be accessed by AWS staff for diagnostic purposes while the majority are directly useful for other database users & administrators. 

Additionally, system tables are distinguished based on the type and nature of data they store. This distinction is identified by their naming prefixes.

What are Redshift System Views?

System views unlike system tables do not hold the information, they display the information about the system. System views could be thought of as the virtual views of the system tables based on their types. However, system views do not only contain data in the tables; some of them contain referential data and subsets of data found in the system tables.

Furthermore, System views are distinguished by their naming prefixes. These naming prefixes are used across Redshift’s naming schemes to identify different elements.

System views provide faster and easier access to the data in system tables without being queried. This explains why they work together but serve different purposes.

Note: The data stored in system tables are from Redshift’s clusters and nodes and their operations. These monitoring data are stored mainly for diagnostic purposes by the system administrators.

Empowered Data Analysis with Hevo’s No-code Data Pipeline!

A fully managed No-code Data Pipeline platform like Hevo helps you integrate data from 100+ other data sources to a destination of your choice in real-time. Hevo platform has a minimal learning curve can be set up in just a few minutes.

Get Started with Hevo for Free

Check out some of the cool features of Hevo:

  • Completely Automated: The Hevo platform can be set up in just a few minutes and requires minimal maintenance.
  • Real-Time Data Transfer: Hevo provides real-time data migration, so you can have analysis-ready data always.
  • 100% Complete & Accurate Data Transfer: Hevo’s robust infrastructure ensures reliable data transfer with zero data loss.
  • Scalable Infrastructure: Hevo has in-built integrations for 100+ sources like Excel and Python, that can help you scale your data infrastructure as required.
  • 24/7 Live Support: The Hevo team is available round the clock to extend exceptional support to you through chat, email, and support calls.
  • Schema Management: Hevo takes away the tedious task of schema management & automatically detects the schema of incoming data and maps it to the destination schema.
  • Live Monitoring: Hevo allows you to monitor the data flow so you can check where your data is at a particular point in time.

Try Hevo for free! Sign up here for a 14-Day Free Trial!

Types of Redshift System Tables and Views.

Note: Keep in mind the differences between system tables and views while going through this section.

System tables and views do not maintain the same consistency and rigidity as traditional tables. Their content is dependent on their nature.

Types of Redshift System Tables.

  1. STV tables: STV tables contain snapshots of the current system data. Why snapshots? STV tables only hold data pertaining to the system at that point in time – the data stored in the table is transient. They are preceded by the STV naming prefix, for example, STV_SESSIONS.
  2. STL tables: STL tables contain historical system logs that have been persisted to disk. They are not usually interacted with directly, most of the querying is done with STL views.

Emphatically, system tables give administrators deeper insights into the system’s performance and log. These insights are used to diagnose the entire system and roll out updates to the database users regarding the state of their clusters.

Types of Redshift System Views.

STL views: STL views are generated from the system log files stored every node in Redshift’s clusters. These logs are persisted to the disk to provide a history of the system. In a nutshell, STL views are used for data regarding system logging.

Examples:

  • STL_INSERT – Analyzes insert execution steps for queries.
  • STL_LOAD_COMMITS – Returns information to track or troubleshoot a data load.

SVV views: SVV views contain referential data. They contain references to STV tables and their transient values. They are preceded by the SVV naming prefix.

Example: 

  • SVV_ALL_COLUMNS: Used to view catalog information about the columns of local and external tables and views.
  • SVV_QUERY_STATE: used to view information about the execution of currently running queries.

SVCS views: SVCS views provide information about queries in main and concurrency scaling clusters in the data warehouse. The data in SVCS views are similar to those in the STL views except that data in STL views are only for the main clusters in the data warehouse.

Example: 

  • SVCS_COMPILE – Records compile-time and location for each query run on either the main cluster or a scaling cluster.
  • SVCS_CONCURRENCY_SCALING_USAGE – Records the usage periods for concurrency scaling.

SVL views: Also considered referential views, they contain references to STL tables and the logs they contain. Just like system views, they provide quicker and easier access to frequently accessed data in the tables.

Example:

  •  SVL_TERMINATE – Records the time when a user cancels or terminates a process.
  • SVL_USER_INFO: SVL_USER_INFO view is used to retrieve data about Amazon Redshift database users.

Data Visibility and Manipulation in Redshift System Tables and Views

The level of data visibility a database user gets is dependent on the user role – regular user or superuser. As privileges go, the data in tables that are in the superuser category are only visible by superusers, and the same goes for regular users.

However, the privileges of regular users can change depending on the circumstances. The GRANT command is used to grant a regular user access to view superuser tables. The GRANT command is also used alongside the SELECT command to pick the privileges to be applied for the user on a particular table.

Syntactically: GRANT SELECT ALL [PRIVILEGES] ON TABLE table_name TO [USERNAME | GROUP].

Examples:

  • GRANT SELECT ON TABLE schema TO GROUP admin. (for a group)
  • GRANT SELECT ON TABLE customers TO hevo. (for user)

Once a user has been granted access(limited or full), they can perform operations on a table under the superuser category.

Note: If a user is given unrestricted access to tables, the user can generate other users.

Conclusion

Amazon Redshift system tables do not work alone. This article has explained what system tables are in Redshift and their types. It has also discussed system views and their usage with system tables, as well as privilege-based access to the data stored in them.

Related Articles:

  1. A Comprehensive Amazon Redshift Tutorial 101
  2. Redshift System Tables Reference

On the other hand, if you want to automate the real-time loading of data from various Databases, SaaS Applications, Cloud Storage, SDKs, and Streaming Services into Amazon RedshiftHevo Data is the right choice for you.

Hevo Data is a no-code data pipeline platform that helps new-age businesses integrate their data from multiple sources systems to a data warehouse and plug this unified data into any BI tool or Business Application. The platform provides 100+ ready-to-use integrations with a range of data sources and is trusted by hundreds of data-driven organizations from 30+ countries.

visit our website to explore hevo[/hevoButton]

Want to take Hevo for a spin? Sign Up here for a 14-day free trial and experience the feature-rich Hevo suite first hand. Also, don’t forget to look at our unbeatable pricing!

No-code Data Pipeline for Redshift