Re: 7.4.7: strange planner decision

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: Roman Neuhauser <neuhauser(at)sigpipe(dot)cz>, pgsql-general(at)postgresql(dot)org
Subject: Re: 7.4.7: strange planner decision
Date: 2005-07-13 14:15:20
Message-ID: 27805.1121264120@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Huxton <dev(at)archonet(dot)com> writes:
> What happens to the plan if you SET enable_seqscan=false; first? It's
> presumably getting the row-estimate right, so unless there's terrible
> correlation on "base" in the files table I can only assume it's getting
> the cost estimates horribly wrong.

I think you'll find that the results suck ;-). It looks to me that the
planner is making exactly the right choice here. The only plausible
alternative is a nestloop with inner indexscan on "files", which would
imply 176160 separate index probes into "files", which is unlikely to
win compared to one seqscan. (In the aggregate the index probes are
likely to end up touching every page of "files" anyway --- you would
need a much larger files table before this stopped being true.)

If you want to compare the nestloop plan to test this theory, turning
off enable_hashjoin and (if necessary) enable_mergejoin would be the
better way to get it. But let's see EXPLAIN ANALYZE results for both
cases, not just EXPLAIN.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Einar Indridason 2005-07-13 14:19:32 Re: Strange memory behaviour with PGreset() ...
Previous Message Roman Neuhauser 2005-07-13 14:14:27 Re: 7.4.7: strange planner decision