Re: Planner question

From: Tom Raney <raneyt(at)cecs(dot)pdx(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Postgres Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Planner question
Date: 2008-09-10 20:16:33
Message-ID: 48C82B21.1020306@cecs.pdx.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Tom Raney <raneyt(at)cecs(dot)pdx(dot)edu> writes:
>> Why does the index scan for tenk1 include a path key from
>> onek.unique2? Is it implying an equivalence there?
>
>> bench=# explain select * from tenk1 JOIN onek ON
>> tenk1.unique2=onek.unique2;
>
> Yes, for an example like that the planner knows that tenk1.unique2 and
> onek.unique2 will have equal values in any valid join row, so it's okay
> to suppose that a sort by one is the same as a sort by the other. So
> the pathkey items actually reference sets of variables
> {tenk1.unique2, onek.unique2}
> not just individual variables.

Thanks.

>
>> RELOPTINFO (tenk1): rows=10000 width=244
>> path list:
>> SeqScan(tenk1) rows=10000 cost=0.00..434.00
>> IdxScan(tenk1) rows=10000 cost=0.00..583.25
>> pathkeys: ((tenk1.unique2, onek.unique2)) <---
>
>> cheapest startup path:
>> SeqScan(tenk1) rows=10000 cost=0.00..434.00
>
>> cheapest total path:
>> SeqScan(tenk1) rows=10000 cost=0.00..434.00
>
> Hm, I don't recognize this output format, is it coming from some custom
> code?

Yes, it is. I thought it was easier to read the OPTIMIZER_DEBUG
output with the relation names instead of the relation indexes. I
will post a patch against CVS HEAD if you think it will help others.

-Tom

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2008-09-10 20:27:33 Re: Interesting glitch in autovacuum
Previous Message Tom Lane 2008-09-10 20:11:04 Re: Interesting glitch in autovacuum