On Wed, 2009-04-15 at 14:04 +0200, Christian Schröder wrote:
> Grzegorz Jaśkiewicz wrote:
> > set work_mem=24000; before running the query.
> >
> > postgres is doing merge and sort on disc, that's always slow.
> >
> Ok, but why is the plan different in 8.2? As you can see the same query
> is really fast in 8.2, but slow in 8.3.
The cost of the query seems accurate, so the absence of
attachment_isins_attachment_idx on the 8.3 plan looks to be the reason.
There's no way it would choose to scan 8115133 rows on the pkey if the
other index was available and usable.
--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support