Robins Tharakan <tharakan(at)gmail(dot)com> writes:
> I completely agree. With 'irrelevant' I was only trying to imply that
> irrespective of the complexity of the query, a replicated box was seeing
> similar slowness whereas a Restored DB wasn't. It felt that the SQL itself
> isn't to blame here...
Without having at least compared EXPLAIN outputs from the two boxes, you
have no business jumping to that conclusion.
If EXPLAIN does show different plans, my first instinct would be to wonder
whether the pg_stats data is equally up-to-date on both boxes.
regards, tom lane