Quickest way to find out heroku database size
Ruby on-RailsPostgresqlHerokuRuby on-Rails Problem Overview
What is the quickest way to find out the current size of my shared database in Heroku?
Ruby on-Rails Solutions
Solution 1 - Ruby on-Rails
running heroku info
shows:
Data size: 480k
Addons: Basic Logging, Shared Database 5MB
Data size being the size of the shared database, here with a limit of 5MB.
Solution 2 - Ruby on-Rails
From the same doc page as posted by nate c:
heroku pg:info
This only seems to work if you're not using the shared DB, but using PG as an add-on
Also, make sure your heroku gem is up to date:
sudo gem update heroku
Any ideas on how to see the size of a shared db? I just did a heroku db:pull and then a mysqldump and looked at the file size, figured that was a good rough estimate.
Solution 3 - Ruby on-Rails
The new way seems to be:
heroku pg:info -a myapp
You'll see something like:
=== HEROKU_POSTGRESQL_PURPLE_URL (DATABASE_URL)
Plan: Dev
Status: available
Connections: 1
PG Version: 9.1.5
Created: 2012-10-19 01:27 UTC
Data Size: 12.1 MB
Tables: 31
Rows: 36068/10000 (Above limits, access disruption imminent)
Fork/Follow: Unavailable
Solution 4 - Ruby on-Rails
Based on Nate's answer:
For shared DB w/o installing Postgres on your local machine
heroku console
ActiveRecord::Base.connection.execute("SELECT pg_size_pretty(pg_database_size('postgres'))").first
'postgres' is the name of my shared DB, when I put in template0 or template1 I get the same number back.
Solution 5 - Ruby on-Rails
You can log into Posgtgresql directly.
type heroku pg:psql
.
But you have to have postgres on your local system as well so you can use pgsql
(which is the command line interface for pg.)
If you do not know what the db name is then type \l in
pgsql to list databases. (postgres, template0, and template1 are system databases in every install.)
Then
SELECT pg_size_pretty(pg_database_size('dbname'));
Solution 6 - Ruby on-Rails
In heroku postgres panel you can see everything https://postgres.heroku.com/