From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com> |
Cc: | "Hannes Dorbath" <light(at)theendofthetunnel(dot)de>, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Yet another question on LIMIT performance :/ |
Date: | 2006-11-06 14:33:02 |
Message-ID: | 10614.1162823582@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
"Heikki Linnakangas" <heikki(at)enterprisedb(dot)com> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Carlos H. Reimer | 2006-11-06 18:29:13 | RES: Context switching |
Previous Message | Hannes Dorbath | 2006-11-06 14:21:35 | Re: Yet another question on LIMIT performance :/ |