Skip to main content

Amazon Redshift - Table Statistics

Imported Statistics​

info

Statistics are imported when the Import row count and statistics option is selected for the metadata import task.

StatisticsIs importedDescription
Row countIndicates the number of rows in table
Last user queryTime of last user SELECT operation on table
Number of user queriesNumber of user SELECT operation on table
Last user updateTime of last user INSERT, UPDATE and DELETE operations on table
Number of user updatesSum of user INSERT, UPDATE and DELETE operations on table
Last load timeTime of last user COPY command on table

Requirements​

Dataedo requires access to the following tables and views:

ObjectUsed for
pg_classRow count
pg_namespaceSchema resolution for row count
SYS_QUERY_HISTORYQuery type and status behind the query and update counters
SYS_QUERY_DETAILPer-table query timestamps
SVV_TABLE_INFOMapping query history to table names

Row count comes from the catalog and works for any user with USAGE on the schema. Everything else does not:

  • Amazon Redshift documents that SVV_TABLE_INFO is "visible only to superusers".
  • SYS_QUERY_HISTORY is "visible to all users. Superusers can see all rows; regular users can see only their own data."

A dedicated read-only Dataedo account therefore imports row count only. Query-based statistics need elevated privileges — the query and update counters, timestamps, and last load time stay empty until the account is a superuser or receives the access below:

ALTER USER dataedo_user SYSLOG ACCESS UNRESTRICTED;
GRANT SELECT ON SVV_TABLE_INFO TO dataedo_user;

Limitations​

  • Row count is only an estimate used by the planner. It is updated by VACUUM, ANALYZE, and a few DDL commands. If the table has never been vacuumed or analyzed, the row count is 0.
  • SVV_TABLE_INFO returns no information for empty tables, so tables that have never held data get no query statistics.
  • Amazon Redshift purges query history automatically. Activity older than the retention window of your cluster or workgroup is no longer reflected in the counters and timestamps.

Learn more​

Read more about table statistics import in main article

Dataedo is an end-to-end data governance solution for mid-sized organizations.
Data Lineage • Data Quality • Data Catalog