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.
| Statistics | Is imported | Description |
|---|---|---|
| Row count | Indicates the number of rows in table | |
| Last user query | Time of last user SELECT operation on table | |
| Number of user queries | Number of user SELECT operation on table | |
| Last user update | Time of last user INSERT, UPDATE and DELETE operations on table | |
| Number of user updates | Sum of user INSERT, UPDATE and DELETE operations on table | |
| Last load time | Time of last user COPY command on table |
Requirements
Dataedo requires access to the following tables and views:
| Object | Used for |
|---|---|
pg_class | Row count |
pg_namespace | Schema resolution for row count |
SYS_QUERY_HISTORY | Query type and status behind the query and update counters |
SYS_QUERY_DETAIL | Per-table query timestamps |
SVV_TABLE_INFO | Mapping 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_INFOis "visible only to superusers". SYS_QUERY_HISTORYis "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_INFOreturns 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