PostgreSQL 9.1 Available in Beta

One of the benefits of consuming a database through Heroku Postgres is that we are continually improving the service. This benefit is compounded by the fact that our service is based on PostgreSQL, a vibrant and active open source project. The release of PostgresSQL 9.1 had added a number of feature, performance and reliability improvements. These are available today with our beta support for PostgreSQL 9.1.

We have been testing and watching PostgreSQL 9.1 since it became available in September. With the recent release of 9.1.2, it is now ready for prime time on Heroku. Test out PG 9.1 right now with:

$ heroku addons:add heroku-postgresql version=9.1

PostgreSQL 9.1 can also be selected when provisioning a database through our web-based control surface.

Although PostgreSQL 9.1 has been tested internally by Heroku for some time, there is always a risk that beta services will have unforeseen problems. Please be extremely conservative in moving production applications.

Performance Improvements

Most Heroku Postgres users will see an immediate performance boost upon upgrading to PostgreSQL 9.1. Optimizations in file system writes will result in reduced latency on typical production database loads.

In addition, unlogged tables create a variety of interesting new use cases. Unlogged tables are not written to disk and offer extremely fast performance (up to 5x write speeds in some cases). They are well suited to ephemeral data such as work queues. Please note that unlogged tables are not replicated to followers. The data in unlogged tables does not survive a database restart or failure.

Upgrade Path and Roadmap

PostgreSQL 9.1 is available in beta as an option on all new databases. If you test it, please send feedback to

Once PostgreSQL 9.1 has been run for a sufficient amount of time with a variety of customer databases, it will be placed into general availability and will become the default for all new databases.

Existing users of Heroku Postgres will continue to run PostgreSQL 9.0. As a policy, we do not upgrade running databases unless there is a security vulnerability. Existing databases can be upgraded by capturing a snapshot of the database and restoring it to a new database.

Deploy Grails Applications on Heroku

We're happy to announce the public beta of Grails application deployment on Heroku with support for Grails 1.3.7 and 2.0 provided by the open source Heroku Grails buildpack.

Grails is a high-productivity web application framework for the JVM based on the Groovy programming language and featuring many similarities with Rails. Since its inception in 2006, the framework has enjoyed broad adoption in the Java community as it combines the strengths of the JVM and richness of the Java platform with the productivity benefits of modern frameworks like Rails.

Today the Grails team announced Grails 2.0, the latest incarnation of the framework. It features numerous large improvements including an overhauled command line tool, faster and more reliable reloads, and static asset support. Details are covered in the What's New section of the Grails docs.

The release includes the Grails Heroku plugin that provides simple commands to set up your Grails app with Heroku add-on services like Postgres, Memcached, Redis, MongoDB from MongoLabs or MongoHQ and RabbitMQ.

Deploying a Grails app on Heroku

Create a new Grails project:

$ grails createApp HelloWorld
| Created Grails Application at /Users/jjoergensen/dev/HelloWorld
$ cd HelloWorld

Commit to Git:

$ grails integrate-with --git
$ git init
Initialized empty Git repository in /Users/jjoergensen/dev/HelloWorld/.git/
$ git add .
$ git commit -m init
[master (root-commit) bd0f36b] init
 58 files changed, 2788 insertions(+), 0 deletions(-)
 create mode 100644 .classpath
 create mode 100644 .gitignore
 create mode 100644 .project

Create Heroku Cedar app:

$ heroku create --stack cedar
Creating smooth-night-8061... done, stack is cedar |
Git remote heroku added

Deploy to Heroku:

$ git push heroku master
Counting objects: 73, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (69/69), done.
Writing objects: 100% (73/73), 97.82 KiB, done.
Total 73 (delta 2), reused 0 (delta 0)

-----> Heroku receiving push
-----> Grails app detected
-----> Grails 2.0.0 app detected
-----> Installing Grails 2.0.0..... done
-----> executing grails -plain-output -Divy.default.ivy.user.dir=/app/tmp/repo.git/.cache war

       |Loading Grails 2.0.0.
       |Done creating WAR target/HelloWorld-0.1.war
-----> No server directory found. Adding jetty-runner 7.5.4.v20111024 automatically.
-----> Discovering process types
       Procfile declares types  -> (none)
       Default types for Grails -> web
-----> Compiled slug size is 30.6MB
-----> Launching... done, v3 deployed to Heroku

Learn More

Heroku Postgres Launches

Heroku's Postgres database service, the origins of which date back to 2007, is one of the most battle-tested cloud database services around.

Over the last year, our growing data team has done an amazing job of dramatically increasing the scale, reliability, and durability of the service - now boasting 99.99% (measured) uptime and over 400 million write-transactions per day.

Until now, the service has only been available to Heroku customers, but today we are pleased to announce the launch of Heroku Postgres as a standalone database service. Included in this launch is a new web interface for managing databases, as well as rock-solid durability based on Continuous Protection technology.  Best of all, these improvements are effective immediately for all existing users of the Heroku Postgres add-on.

To learn more, check out the inaugural post of the new Heroku Postgres blog.  Future posts to this blog will contain product updates and articles about leveraging the advantages of PostgreSQL.

Announcing Heroku Postgres

Until now, Heroku's Postgres database service - originally launched in 2007 - has only been available to Heroku customers for use with Heroku platform apps. Today we're excited to announce the launch of Heroku Postgres as a standalone service.

With measured service uptime of four nines (99.99%), and designed data durability of eleven nines (99.999999999%), the service is trustworthy for mission-critical data. As of today, these production-quality Heroku Postgres databases are independently available for use from any cloud platform, provisioned instantly, metered by the second, and without contract.

Battle Tested

Heroku Postgres has successfully and safely written 19 billion customer transactions, and another 400 million write-transactions are processed every day. Leverage Heroku's scale and expertise while enabling your team to focus on building great apps rather than managing and configuring databases.

Continuous Protection

The safety and durability of your data is our number one priority. Continuous Protection is a set of technologies designed to prevent any kind of data loss even in the face of catastrophic failures. Taking advantage of PostgreSQL's WAL (write-ahead-log of each change to the database's data or schema), Heroku Postgres creates multiple, geographically distributed copies of all data changes as they are written. These copies are constantly checked for consistency and corruption. If a meteor were to wipe out the east coast, you won't lose your data. Continuous Protection come standard with every database running on Heroku Postgres.

100% Pure PostgreSQL

We believe deeply in the value of open-source software, and believe it is even more critical in the context of a database service. We are committed to running off-the-shelf, community PostgreSQL - unforked and unmodified. Rest assured that any standard libpq client will run flawlessly on our service. Should you ever decide that you want to go back to being your own DBA, you can; there is no technical lock-in.

Great Tools for Visibility and Productivity

Heroku Postgres has a rich API, accessible via command-line tools and a clean and simple web-based UI. Use it for provisioning, generating connection strings, viewing usage statistics, and capturing snapshots. These tools work for both standalone databases and those attached to Heroku apps.

The best way to learn more about the service is to give it a try, so check out to signup and provision a database today.

Heroku Scheduler Add-on Now Available

Today we're happy to announce the availability of Heroku Scheduler. Scheduler is an add-on for running administrative or maintenance tasks, or jobs, at scheduled time intervals. It's the polyglot replacement of the Cron add-on, with more power and flexibility. And it's free; you just pay for the dyno time consumed by the one-off tasks.

A dashboard allows you to configure jobs to run every 10 minutes, every hour, or every day, and unlike the Cron add-on, you can control when. E.g. Every hour on the half-hour, or every day at 7:00am.

Scheduler Dashboard

Polyglot Tasks

Tasks are any command that can be run in your application or even the Unix shell.

For Rails, the convention is to set up rake tasks. To create your scheduled tasks in Rails, copy the code below into lib/tasks/scheduler.rake and customize it to fit your needs.

desc "This task is called by the Heroku scheduler add-on"
task :update_feed => :environment do
    puts "Updating feed..."
    puts "done."

task :send_reminders => :environment do

If you're using Python with the popular Fabric automation tool, you can define a fab clean_sessions task:

from fabric.api import task

def clean_sessions():
    url = urlparse(os.environ.get('REDISTOGO_URL'))
    db = redis.Redis(host=url.hostname, port=url.port, password=url.password)
    print 'done.'

For apps built on other frameworks or languages, another convention is to add a script to bin/ that will perform the task. E.g. bin/updater.

Scheduling Jobs

To schedule a frequency and time for a job, open the scheduler dashboard by finding the app in My Apps, clicking "General Info", then selecting "Scheduler" from the Add-ons dropdown.

On the Scheduler Dashboard, click "Add Job...", enter a task, select a frequency and next run time.

Note that the next run time for daily jobs is in UTC. If you want to schedule the job at a certain local time, add the proper UTC offset.

For example, add rake update_feed, select "Hourly" and ":30" to update feeds every hour on the half-hour. Then add rake send_reminders, select "Daily" and "00:00" to send reminders every day at midnight.

Migrating From the Cron Add-on

Existing Cron add-on users should migrate to Heroku Scheduler as soon as possible. It has more functionality, is easier to use, and is free. Cron is restricted to running a single command, rake cron and does not provide control over when daily and hourly tasks are run. Scheduler can do everything the Cron add-on does, and more.

If you want your new jobs to be scheduled as close as possible to when your Cron jobs would run, go to the Cron dashboard and look at the "Scheduled for" information. Then in the Scheduler dashboard, create a new task, set it to be either hourly or daily, and then set the Next Run field to the selection closest to the previous scheduled time. Set the task to rake cron.

Browse the blog archives or subscribe to the full-text feed.