Heroku Postgres Metrics Logs
Last updated 07 January 2019
Heroku Postgres Standard and Premium Tier database users will see database-related events on their app’s log stream. This can be useful for recording and analyzing usage over time.
Heroku Postgres Metrics which appear via
heroku-postgres are separate from standard alerts emitted from Postgres itself which appear for all applications via
2013-05-07T17:41:06+00:00 source=HEROKU_POSTGRESQL_VIOLET addon=postgres-metric-68904 sample#current_transaction=1873 sample#db_size=26219348792bytes sample#tables=13 sample#active-connections=92 sample#waiting-connections=1 sample#index-cache-hit-rate=0.99723 sample#table-cache-hit-rate=0.99118 sample#load-avg-1m=1.42 sample#load-avg-5m=1.45 sample#load-avg-15m=1.34 sample#read-iops=0 sample#write-iops=2.875 sample#memory-total=1692568kB sample#memory-free=73876kB sample#memory-cached=1344128kB sample#memory-postgres=22388kB
The following attributes appear in application logs for all standard and premium tier databases.
source: The database attachment name that the measurements relate to.
addon: The database addon name that the measurements relate to.
- The log line’s timestamp is the time at which the measurements were taken.
These attributes apply to a particular database. They are the same for single-tenant and multitenant database plans.
sample#db_size: The number of bytes contained in the database. This includes all table and index data on disk, including database bloat.
sample#tables: The number of tables in the database.
sample#active-connections: The number of connections established on the database.
sample#current_transaction: The current transaction ID, which can be used to track writes over time.
sample#index-cache-hit-rate: Ratio of index lookups served from shared buffer cache, rounded to five decimal points. Heroku recommends a value of 0.98 or greater if possible. If your index hit rate is consistently less than 0.98, you should investigate your Expensive Queries or you may need to upgrade your database plan for more RAM.
sample#table-cache-hit-rate: Ratio of table lookups served from shared buffer cache, rounded to five decimal points. Heroku recommends a value of 0.98 or greater if possible. If your table hit rate is consistently less than 0.98, you may need to upgrade your database plan for more RAM.
sample#waiting-connections: Number of connections waiting on a lock to be acquired. If many connections are waiting, this can be a sign of mishandled database concurrency.
sample#memory-postgres: Approximate amount of memory used by your database’s Postgres processes in kB. This includes shared buffer cache as well as memory for each connection.
These metrics come directly from the server operating system. For multi-tenant plans, the metrics include other databases running on the shared server, and may be misleading when diagnosing database performance.
sample#load-avg-15m: The average system load over a period of 1 minute, 5 minutes and 15 minutes, divided by the number of available CPUs. A
load-avgof 1.0 indicates that, on average, processes were requesting CPU resources for 100% of the timespan. This number includes I/O wait. For databases that have burstable performance, a baseline load average is guaranteed. For more information see the burstable performance section in the technical characteristic article.
sample#write-iops: Number of read or write operations in I/O sizes of 16KB blocks.
sample#memory-total: Total amount of server memory in use, in kB. This includes memory used by all Postgres processes, OS memory, and disk cache.
sample#memory-free: Amount of free memory available in kB.
sample#memory-cached: Amount of memory being used the OS for page cache, in kB.