I was having some puzzling behavior from my Heroku application. A page
with a simple query that joined two tables (one small, one enormous)
was taking minutes to return and bringing down my whole app with
timeouts.

I downloaded the bundle and installed it into my development machine,
and the same page with that query loaded flawlessly.

After poking around some more, I narrowed the problem down to the
database. We don't have direct database access, so I loaded up the
Heroku console and called on my table:
ActiveRecord::Base.connection.execute "analyze X"

After that the same pages and queries return instantaneously, and the
problem was resolved. I had originally tried calling vacuum analyze,
but that takes too long for the Heroku command line and timed out.

It seems strange to me that I would have to do this myself given we
don't even have database access, but this problem persisted for two
days between when I first observed it and when I finally resolved it.

Does Heroku have auto-vacuum/analyze configured and running on our
Postgres databases? When should we be running analyze ourselves?

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to