Brandon Casci <brandon@xxxxxxxxxxxxxx> writes: > I have an application hosted on Heroku. They use postgres. It's more or less > abstracted away, but I can get some performance data from New Relic. For the > most part, performance is ok, but now and then some queries take a few > seconds, and spike up to 15 or even 16 seconds! Ouch! The particular query you're showing here doesn't look terribly expensive. Are you sure this is one that took that long? If you're seeing identical queries take significantly different times, I'd wonder about what else is happening on the server. The most obvious explanation for that type of behavior is that everything is swapped into RAM when it's fast, but has to be read from disk when it's slow. If that's what's happening you should consider buying more RAM or offloading some activities to other machines, so that there's not so much competition for memory space. If specific queries are consistently slow then EXPLAIN might give some useful info about those. It's unlikely to tell you much about non-reproducible slowdowns, though. regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance