Skip Navigation
Show nav
Heroku Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Heroku Blog

    Find out what's new with Heroku on our blog.

    Visit Blog
  • Log inorSign up
View categories

Categories

  • Heroku Architecture
    • Dynos (app containers)
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Command Line
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery
    • Continuous Integration
  • Language Support
    • Node.js
    • Ruby
      • Rails Support
      • Working with Bundler
    • Python
      • Background Jobs in Python
      • Working with Django
    • Java
      • Working with Maven
      • Java Database Operations
      • Working with the Play Framework
      • Working with Spring Boot
      • Java Advanced Topics
    • PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
    • Heroku Data For Redis
    • Apache Kafka on Heroku
    • Other Data Stores
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
    • Compliance
  • Heroku Enterprise
    • Private Spaces
      • Infrastructure Networking
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
    • Single Sign-on (SSO)
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Databases & Data Management
  • Heroku Postgres
  • Postgres Performance
  • Heroku Postgres Metrics Logs

Heroku Postgres Metrics Logs

English — 日本語に切り替える

Last updated December 09, 2022

Table of Contents

  • Log format
  • Database metrics
  • Server metrics
  • PgBouncer Metrics

Heroku Postgres Standard and Premium Tier database users see database-related events on their app’s log stream. These events are useful for recording and analyzing usage over time.

Heroku Postgres Metrics that appear via heroku-postgres are separate from standard alerts emitted from Postgres itself that appear for all applications via postgres.

Log format

Nov 09 23:56:02 source=HEROKU_POSTGRESQL_SILVER addon=postgresql-devcenter-123456 sample#current_transaction=54017686 sample#db_size=16012956319bytes sample#tables=97 sample#active-connections=7 sample#waiting-connections=0 sample#index-cache-hit-rate=0.9239 sample#table-cache-hit-rate=0.93609 sample#load-avg-1m=0 sample#load-avg-5m=0 sample#load-avg-15m=0 sample#read-iops=0 sample#write-iops=0.13333 sample#tmp-disk-used=33849344 sample#tmp-disk-available=72944943104 sample#memory-total=4044960kB sample#memory-free=46920kB sample#memory-cached=3667532kB sample#memory-postgres=20824kB sample#wal-percentage-used=0.06512959334021144

The following attributes appear in application logs for all standard and premium tier databases.

  • source: The database attachment name that the measurements relate to (for example, HEROKU_POSTGRESQL_VIOLET).
  • addon: The database addon name that the measurements relate to (for example, postgres-metric-68904).
  • The log line’s timestamp is the time at which the measurements were taken.

Database metrics

These attributes apply to a particular database. They’re the same for single-tenant and multitenant database plans.

  • sample#db_size: The number of bytes contained in the database. This metric 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#waiting-connections: Number of connections waiting on a lock to be acquired. If many connections are waiting, this metric can be a sign of mishandled database concurrency.
  • 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.99 or greater if possible. If your index hit rate is consistently less than 0.99, investigate your Expensive Queries or 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.99 or greater if possible. If your table hit rate is consistently less than 0.99, upgrade your database plan for more RAM.
  • sample#memory-postgres: Approximate amount of memory used by your database’s Postgres processes in kB. This metric includes shared buffer cache as well as memory for each connection.
  • sample#follower-lag-commits: Replication lag, measured as the number of commits that this follower is behind its leader. Replication is asynchronous so a number greater than zero doesn’t indicate an issue, however an increasing value deserves investigation. Read more in Monitoring Followers. This metric is only published for follower databases.

Server metrics

These metrics come directly from the server operating system. For multi-tenant plans, the metrics include other databases running on the shared server, and can be misleading when diagnosing database performance.

  • sample#load-avg-1m, sample#load-avg-5m and 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-avg of 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#read-iops and sample#write-iops: Number of read or write operations in I/O sizes of 16-KB blocks.
  • sample#memory-total: Total amount of server memory available.
  • sample#memory-free: Amount of free memory available in kB.
  • sample#memory-cached: Amount of memory being used by the OS for page cache, in kB.
  • sample#memory-postgres: Amount of memory being used by Postgres in kB.
  • sample#tmp-disk-used, sample#tmp-disk-available: Number of bytes used/available on tmp mount.
  • sample#wal-percentage-used: Percentage of the WAL disk that has been used, between 0.0 and 1.0. See this article for more details.

The operating system is designed to maximize the amount of memory it uses for its page cache, but can sometimes release that memory if an application requests it. For an estimate of the total amount of memory available to your server, add sample#memory-free and sample#memory-cached together.

PgBouncer Metrics

These metrics are included for any Heroku Postgres server that has a PgBouncer pooler attachment. These metrics are a subset of those viewable by running the SHOW POOLS; command when connected to PgBouncer’s special internal database.

  • sample#client_active: The number of client connections to the pooler that have an active server connection assignment.
  • sample#client_waiting: The number of client connections to the pooler that are waiting for a server connection assignment.
  • sample#server_active: The number of server connections that are currently assigned to a client connection.
  • sample#server_idle: The number of server connections that aren’t currently assigned to a client connection.
  • sample#max_wait: The longest wait time of any client currently waiting for a server connection assignment.
  • sample#avg_query: The average query time of all queries executed through pooled connections.
  • sample#avg_recv: The number of bytes received from clients per second.
  • sample#avg_sent: The number of bytes sent to clients per second.

Keep reading

  • Postgres Performance

Feedback

Log in to submit feedback.

Understanding Heroku Postgres Data Caching Heroku Postgres Performance Analytics

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Podcasts
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing

Subscribe to our monthly newsletter

Your email address:

  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Heroku Podcasts
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Facebook
  • Instagram
  • Github
  • LinkedIn
  • YouTube
Heroku is acompany

 © Salesforce.com

  • heroku.com
  • Terms of Service
  • Privacy
  • Cookies
  • Cookie Preferences