System tables and commands in Aurora DSQL
See the following sections to learn about the supported system tables and catalogs in Aurora DSQL.
System tables
Aurora DSQL is compatible with PostgreSQL, so many system catalog
tables
Important PostgreSQL catalog tables and views
The following table describes the most common tables and views you might use in Aurora DSQL.
| Name | Description |
|---|---|
|
|
Information on all schemas |
|
|
Information on the all tables |
|
|
Information on all attributes |
|
|
Information on (pre-)defined views |
|
|
Describes all tables, column, indices, and similar objects |
|
|
A view on the planner statistics |
|
|
Information on users |
|
|
Information on users and groups |
|
|
Lists all indexes |
|
|
Lists constraints on tables |
Supported and unsupported catalog tables
The following table indicates which tables are supported and unsupported in Aurora DSQL.
| Name | Applicable to Aurora DSQL |
|---|---|
|
|
No |
|
|
Yes |
|
|
No |
|
|
No |
|
|
Yes |
|
|
Yes |
|
|
No (use |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
No |
|
|
No |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
Yes |
|
|
Yes |
|
|
No |
|
|
No |
|
|
No |
|
|
Yes |
|
|
Yes |
|
|
No |
|
|
Yes |
|
|
No |
|
|
Yes |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
Yes |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
Yes |
|
|
Yes |
|
|
No |
|
|
Yes |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
No |
Supported and unsupported system views
The following table indicates which views are supported and unsupported in Aurora DSQL.
| Name | Applicable to Aurora DSQL |
|---|---|
|
|
No |
|
|
No |
|
|
Yes |
|
|
No |
|
|
No |
|
|
No |
|
|
Yes |
|
|
No |
|
|
No |
|
|
Yes |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
Yes |
|
|
No |
|
|
No |
|
|
No |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
No |
|
|
No |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
No |
|
|
Yes |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
Yes |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
The sys.jobs and sys.iam_pg_role_mappings views
Aurora DSQL supports the following system views:
sys.jobs-
sys.jobsprovides status information about asynchronous jobs. For example, after you create an asynchronous index, Aurora DSQL returns ajob_uuid. You can use thisjob_uuidwithsys.jobsto look up the status of the job.SELECT * FROM sys.jobs WHERE job_id = 'example_job_uuid'; job_id | status | details ------------------+------------+--------- example_job_uuid | processing | (1 row) sys.iam_pg_role_mappings-
The view
sys.iam_pg_role_mappingsprovides information about the permissions granted to IAM users. For example, ifDQSLDBConnectis an IAM role that gives Aurora DSQL access to non-admins and a user namedtestuseris granted theDQSLDBConnectrole and corresponding permissions, you can query thesys.iam_pg_role_mappingsview to see which users are granted which permissions.SELECT * FROM sys.iam_pg_role_mappings;
Useful system metadata queries
Use these queries to get table statistics and metadata without performing expensive operations like full table scans.
Get estimated row count for a table
To get the approximate count of rows in a table without performing a full table scan, use the following query:
SELECT reltuples FROM pg_class WHERE relname = 'table_name';
The command returns output similar to the following:
reltuples -------------- 9.993836e+08
This approach is more efficient than SELECT COUNT(*) for large tables in Aurora DSQL.
The ANALYZE command
The ANALYZE command collects statistics about the contents of tables in the database and stores the results in the pg_stats system view. Subsequently, the query planner uses these statistics to help determine the most efficient execution plans for queries.
In Aurora DSQL, you can't run the ANALYZE command within an explicit transaction. ANALYZE isn't subject to the database transaction timeout limit.
To reduce the need for manual intervention and keep statistics consistently up to date, Aurora DSQL automatically runs ANALYZE as a background process. This background job is triggered automatically based on the observed rate of change in the table. It is linked to the number of rows (tuples) that have been inserted, updated, or deleted since the last analyze.
ANALYZE runs asynchronously in the background and its activity can be monitored in the system view sys.jobs with the following query:
SELECT * FROM sys.jobs WHERE job_type = 'ANALYZE';
Key considerations
Note
ANALYZE jobs are billed like other asynchronous jobs in Aurora DSQL. When you modify a table, this may indirectly trigger an automatic background statistics collection job, which can result in metering charges due to the associated system-level activity.
Background ANALYZEjobs, triggered automatically, collect the same types of statistics as a manual ANALYZE and apply them by default to user tables. System and catalog tables are excluded from this automated process.