RE: [HACKERS] What does explain show ?

From: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
To: "Bruce Momjian" <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: "pgsql-hackers" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: RE: [HACKERS] What does explain show ?
Date: 1999-07-14 03:25:10
Message-ID: 000b01becda8$7a66a660$2801007e@cadzone.tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: Bruce Momjian [mailto:maillist(at)candle(dot)pha(dot)pa(dot)us]
> Sent: Wednesday, July 14, 1999 11:57 AM
> To: Hiroshi Inoue
> Cc: pgsql-hackers
> Subject: Re: [HACKERS] What does explain show ?
>
>
> > Table a has 15905 rows and table b has 25905 rows.
> >
> >
> > For the following query
> >
> > select a.pkey, b.key2 from a, b
> > where b.key1 = 1369
> > and a.pkey = b.key1;
> >
> > "explain" shows
> >
> > NOTICE: QUERY PLAN:
> >
> > Nested Loop (cost=6.19 rows=3 width=10)
> > -> Index Scan using b_pkey on b on b (cost=2.09 rows=2 width=6)
> > -> Index Scan using a_pkey on a on a (cost=2.05 rows=15905 width=4)
> >
> > What does "rows=15905" of InnerPlan mean ?
> > Is "rows=3" of Nested Loop irrelevant to "rows=15905" ?
>
> It means it thinks it is going to access X rows in that pass, but end
> up with 3 joined rows as a result of the nested loop. It is only an
> estimate, based on table size and column uniqueness from vacuum analyze.
>

Hmmm,I couldn't understand where does "rows=15905" come from.
Shouldn't "rows" of InnerPlan be 1 ?
Is the caluculation "rows of Nested loop = rows of OuterPlan * rows of
InnerPlan"
wrong ?

Regards.

Hiroshi Inoue
Inoue(at)tpf(dot)co(dot)jp

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Brent Peckover 1999-07-14 04:43:21 PGSQL on NT - connection to database template1 failed.
Previous Message Bruce Momjian 1999-07-14 02:56:42 Re: [HACKERS] What does explain show ?