Re: [HACKERS] What does explain show ? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] What does explain show ?
Date
Msg-id 199907140256.WAA10942@candle.pha.pa.us
Whole thread Raw
In response to What does explain show ?  ("Hiroshi Inoue" <Inoue@tpf.co.jp>)
Responses RE: [HACKERS] What does explain show ?
List 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@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: "Hiroshi Inoue"
Date:
Subject: What does explain show ?
Next
From: "Hiroshi Inoue"
Date:
Subject: RE: [HACKERS] What does explain show ?