Andy Chambers <achambers@mcna.net> writes:
> We have two copies of roughly* the same database (in a single
> cluster), and on one of them, the query above runs much faster and
> postgresql produces a different query plan for each one. It actually
> returns the same results in both instances. Can anyone think of why
> there is such a difference in performance?
Comparisons like this:
> -> Index Scan using claim_attachments_claim on
> claim_attachments ca (cost=0.00..10.10 rows=2 width=0) (actual
> time=0.004..0.004 rows=0 loops=1741)
> Index Cond: (claim_id = clm.id)
> -> Index Scan using claim_attachments_claim on
> claim_attachments ca (cost=0.00..10241.71 rows=2 width=0) (actual
> time=17.884..17.884 rows=0 loops=1741)
> Index Cond: (claim_id = clm.id)
make it appear that the "slow" DB is rather horribly bloated.
I wonder what your vacuuming policy is like ...
regards, tom lane