

# SQL statistics for RDS PostgreSQL
<a name="USER_PerfInsights.UsingDashboard.AnalyzeDBLoad.AdditionalMetrics.PostgreSQL"></a>

For each SQL call and for each second that a query runs, Performance Insights collects SQL statistics. RDS for PostgreSQL collect SQL statistics only at the digest–level. No statistics are shown at the statement-level. 

Following, you can find information about digest-level statistics for RDS for PostgreSQL. 

**Topics**
+ [Digest statistics for RDS PostgreSQL](#USER_PerfInsights.UsingDashboard.AnalyzeDBLoad.AdditionalMetrics.PostgreSQL.digest)
+ [Per-second digest statistics for RDS PostgreSQL](#USER_PerfInsights.UsingDashboard.AnalyzeDBLoad.AdditionalMetrics.PostgreSQL.per-second)
+ [Per-call digest statistics for RDS PostgreSQL](#USER_PerfInsights.UsingDashboard.AnalyzeDBLoad.AdditionalMetrics.PostgreSQL.per-call)
+ [Primary statistics for RDS PostgreSQL](#USER_PerfInsights.UsingDashboard.AnalyzeDBLoad.AdditionalMetrics.PostgreSQL.primary)

## Digest statistics for RDS PostgreSQL
<a name="USER_PerfInsights.UsingDashboard.AnalyzeDBLoad.AdditionalMetrics.PostgreSQL.digest"></a>

To view SQL digest statistics, RDS PostgreSQL must load the `pg_stat_statements` library. For PostgreSQL DB instances that are compatible with PostgreSQL 11 or later, the database loads this library by default. For PostgreSQL DB instances that are compatible with PostgreSQL 10 or earlier, enable this library manually. To enable it manually, add `pg_stat_statements` to `shared_preload_libraries` in the DB parameter group associated with the DB instance. Then reboot your DB instance. For more information, see [Parameter groups for Amazon RDS](USER_WorkingWithParamGroups.md).

**Note**  
Performance Insights can only collect statistics for queries in `pg_stat_activity` that aren't truncated. By default, PostgreSQL databases truncate queries longer than 1,024 bytes. To increase the query size, change the `track_activity_query_size` parameter in the DB parameter group associated with your DB instance. When you change this parameter, a DB instance reboot is required.

## Per-second digest statistics for RDS PostgreSQL
<a name="USER_PerfInsights.UsingDashboard.AnalyzeDBLoad.AdditionalMetrics.PostgreSQL.per-second"></a>

The following SQL digest statistics are available for PostgreSQL DB instances.


| Metric | Unit | 
| --- | --- | 
| db.sql\$1tokenized.stats.calls\$1per\$1sec | Calls per second | 
| db.sql\$1tokenized.stats.rows\$1per\$1sec | Rows per second | 
| db.sql\$1tokenized.stats.total\$1time\$1per\$1sec | Average active executions per second (AAE) | 
| db.sql\$1tokenized.stats.shared\$1blks\$1hit\$1per\$1sec | Block hits per second | 
| db.sql\$1tokenized.stats.shared\$1blks\$1read\$1per\$1sec | Block reads per second | 
| db.sql\$1tokenized.stats.shared\$1blks\$1dirtied\$1per\$1sec | Blocks dirtied per second | 
| db.sql\$1tokenized.stats.shared\$1blks\$1written\$1per\$1sec | Block writes per second | 
| db.sql\$1tokenized.stats.local\$1blks\$1hit\$1per\$1sec | Local block hits per second | 
| db.sql\$1tokenized.stats.local\$1blks\$1read\$1per\$1sec | Local block reads per second | 
| db.sql\$1tokenized.stats.local\$1blks\$1dirtied\$1per\$1sec | Local block dirtied per second | 
| db.sql\$1tokenized.stats.local\$1blks\$1written\$1per\$1sec | Local block writes per second | 
| db.sql\$1tokenized.stats.temp\$1blks\$1written\$1per\$1sec | Temporary writes per second | 
| db.sql\$1tokenized.stats.temp\$1blks\$1read\$1per\$1sec | Temporary reads per second | 
| db.sql\$1tokenized.stats.blk\$1read\$1time\$1per\$1sec | Average concurrent reads per second | 
| db.sql\$1tokenized.stats.blk\$1write\$1time\$1per\$1sec | Average concurrent writes per second | 

## Per-call digest statistics for RDS PostgreSQL
<a name="USER_PerfInsights.UsingDashboard.AnalyzeDBLoad.AdditionalMetrics.PostgreSQL.per-call"></a>

The following metrics provide per call statistics for a SQL statement.


| Metric | Unit | 
| --- | --- | 
| db.sql\$1tokenized.stats.rows\$1per\$1call | Rows per call | 
| db.sql\$1tokenized.stats.avg\$1latency\$1per\$1call | Average latency per call (in ms) | 
| db.sql\$1tokenized.stats.shared\$1blks\$1hit\$1per\$1call | Block hits per call | 
| db.sql\$1tokenized.stats.shared\$1blks\$1read\$1per\$1call | Block reads per call | 
| db.sql\$1tokenized.stats.shared\$1blks\$1written\$1per\$1call | Block writes per call | 
| db.sql\$1tokenized.stats.shared\$1blks\$1dirtied\$1per\$1call | Blocks dirtied per call | 
| db.sql\$1tokenized.stats.local\$1blks\$1hit\$1per\$1call | Local block hits per call | 
| db.sql\$1tokenized.stats.local\$1blks\$1read\$1per\$1call | Local block reads per call | 
| db.sql\$1tokenized.stats.local\$1blks\$1dirtied\$1per\$1call | Local block dirtied per call | 
| db.sql\$1tokenized.stats.local\$1blks\$1written\$1per\$1call | Local block writes per call | 
| db.sql\$1tokenized.stats.temp\$1blks\$1written\$1per\$1call | Temporary block writes per call | 
| db.sql\$1tokenized.stats.temp\$1blks\$1read\$1per\$1call | Temporary block reads per call | 
| db.sql\$1tokenized.stats.blk\$1read\$1time\$1per\$1call | Read time per call (in ms) | 
| db.sql\$1tokenized.stats.blk\$1write\$1time\$1per\$1call | Write time per call (in ms) | 

## Primary statistics for RDS PostgreSQL
<a name="USER_PerfInsights.UsingDashboard.AnalyzeDBLoad.AdditionalMetrics.PostgreSQL.primary"></a>

The following SQL statistics are available for PostgreSQL DB instances.


| Metric | Unit | 
| --- | --- | 
| db.sql\$1tokenized.stats.calls | Calls  | 
| db.sql\$1tokenized.stats.rows | Rows  | 
| db.sql\$1tokenized.stats.total\$1time | Total time (in ms) | 
| db.sql\$1tokenized.stats.shared\$1blks\$1hit | Block hits  | 
| db.sql\$1tokenized.stats.shared\$1blks\$1read | Block reads  | 
| db.sql\$1tokenized.stats.shared\$1blks\$1dirtied | Blocks dirtied  | 
| db.sql\$1tokenized.stats.shared\$1blks\$1written | Block writes  | 
| db.sql\$1tokenized.stats.local\$1blks\$1hit | Local block hits  | 
| db.sql\$1tokenized.stats.local\$1blks\$1read | Local block reads  | 
| db.sql\$1tokenized.stats.local\$1blks\$1dirtied | Local blocks dirtied | 
| db.sql\$1tokenized.stats.local\$1blks\$1written | Local block writes  | 
| db.sql\$1tokenized.stats.temp\$1blks\$1written | Temporary writes  | 
| db.sql\$1tokenized.stats.temp\$1blks\$1read | Temporary reads  | 
| db.sql\$1tokenized.stats.blk\$1read\$1time | Average concurrent reads (in ms) | 
| db.sql\$1tokenized.stats.blk\$1write\$1time | Average concurrent writes (in ms) | 

For more information about these metrics, see [pg\$1stat\$1statements](https://www.postgresql.org/docs/current/pgstatstatements.html) in the PostgreSQL documentation.