Re: [HACKERS] What does explain show ?

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>
Cc: pgsql-hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] What does explain show ?
Date: 1999-07-14 02:56:42
Message-ID: 199907140256.WAA10942@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 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.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 1999-07-14 03:25:10 RE: [HACKERS] What does explain show ?
Previous Message Hiroshi Inoue 1999-07-14 02:38:54 What does explain show ?