"Heikki Linnakangas" <[EMAIL PROTECTED]> writes:
> Hannes Dorbath wrote:
>> Though it should only have to join a few rows it seems to scan all rows. 

> What makes you think that's the case?

What it looks like to me is that the range of keys present in
pk_revisions_active corresponds to just the upper end of the range of
keys present in pk_revisions (somehow not too surprising).  So the
mergejoin isn't the most effective plan possible for this case --- it
has to scan through much of pk_revisions before it starts getting
matches.  The planner doesn't have any model for that though, and is
costing the plan on the assumption of uniformly-distributed matches.

A nestloop plan would be faster for this specific case, but much
slower if a large number of rows were requested.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

                http://www.postgresql.org/about/donate

Reply via email to