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 Basics
  • Heroku PGSettings

Heroku PGSettings

English — 日本語に切り替える

Last updated December 15, 2022

Table of Contents

  • log-lock-waits
  • log-min-duration-statement
  • log-statement
  • track-functions

Heroku Postgres non-legacy Standard, Premium, Private, and Shield plans can manage database settings by configuring parameters via the pg:settings command.

$ heroku pg:settings postgresql-large-1234 -a example-app
=== postgresql-large-1234
log-lock-waits:             true
log-min-duration-statement: 2000
log-statement:              ddl

Essential-tier plans include the default settings, which you can’t reconfigure.

log-lock-waits

log-lock-waits determines whether a log message is produced when a session waits longer than 1 second to acquire a lock. Lock waits can cause performance issues. The default value in Heroku Postgres is on.

$ heroku pg:settings:log-lock-waits off -a example-app
log-lock-waits has been set to false for postgresql-large-1234.
When a deadlock is detected, no log message will be emitted in your application's logs.

log-min-duration-statement

log-min-duration-statement logs the duration of each completed statement if the statement ran for at least the specified number of milliseconds, where a value of 0 logs everything and a value of -1 disables logging. This setting can help you track down unoptimized queries in your applications. The default value of log-min-duration-statement in Heroku Postgres is set to 2000 milliseconds (2 seconds).

In a system with hundreds of queries executing every second, log files can grow quickly and hamper database performance.

$ heroku pg:settings:log-min-duration-statement 3000 postgresql-large-1234 -a example-app
log-min-duration-statement has been set to 3000 for postgresql-large-1234.

log-statement

log-statement controls which normal SQL statements are logged. This can help you debug complex queries or review queries made by your app or any database user. Valid values for log-statement are:

  • none: Stops logging normal queries. Other logs are still generated such as slow query logs, queries waiting in locks, and syntax errors
  • ddl: All data definition statements, such as CREATE, ALTER, and DROP are logged
  • mod: Includes all statements from ddl as well as data-modifying statements such as INSERT, UPDATE, DELETE, TRUNCATE, COPY
  • all: All statements are logged

The default value of log-statement in Heroku Postgres is ddl.

$ heroku pg:settings:log-statement all postgresql-large-1234 -a example-app
log-statement has been set to all for postgresql-large-1234.

track-functions

track-functions determines which functions have their execution statistics tracked. These statistics can be found in the pg_stat_user_functions view. Valid values for track-functions are:

  • none: No function statistics are recorded. This is the default.
  • pl: Procedural language function statistics are recorded (for example, PL/pgSQL functions).
  • all: All functions, including SQL and C language function statics are recorded.
$ heroku pg:settings:track-functions pl postgresql-large-1234 -a example-app
track-functions has been set to pl for postgresql-large-1234.
Track only procedural-language functions.

Keep reading

  • Postgres Basics

Feedback

Log in to submit feedback.

Upgrading the Version of a Heroku Postgres Database Heroku Postgres

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