pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
query plan estimate
2+ messages / 2 participants
[nested] [flat]

* query plan estimate
@ 2013-03-25 18:16  pg noob <pgnube@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: pg noob @ 2013-03-25 18:16 UTC (permalink / raw)
  To: pgsql-performance

Hi all,

I'm looking at this query plan, an excerpt of which is shown here, and I am
just wondering how the estimated cost for the Nested Loop is calculated?

->  Nested Loop  (*cost=0.00..2888.16* rows=240 width=16) (actual
time=0.034..2.180 rows=91 loops=1)
      Output: public.mg.lctime, public.mg.gfid
      ->  Index Scan using _
ba6cf7271af37e26c0e09e3225369f1b on version  (*cost=0.00..958.13* rows=240
width=8) (actual time=0.013..0.318 rows=91 loops=1)
            Output: version.id, version.gfid, version.tid, version.seq,
version.txsid, version.objectid
      ->  Index Scan using mgfid__uniq on mg  (*cost=0.00..8.03* rows=1
width=16) (actual time=0.005..0.008 rows=1 loops=91)
            Output: public.mg.id, public.mg.gfid, public.mg.ftype,
public.mg.lctime
            Index Cond: (public.mg.gfid = version.gfid)
            Filter: (public.mg.lctime < 1363076849)

What I expected is that it would be the sum of the output cost of the two
index scans?
I have no clue how it came up with 2,888.

Thank you.

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: query plan estimate
@ 2013-04-01 00:52  Tom Lane <tgl@sss.pgh.pa.us>
  parent: pg noob <pgnube@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2013-04-01 00:52 UTC (permalink / raw)
  To: pg noob <pgnube@gmail.com>; +Cc: pgsql-performance

pg noob <pgnube@gmail.com> writes:
> I'm looking at this query plan, an excerpt of which is shown here, and I am
> just wondering how the estimated cost for the Nested Loop is calculated?

http://www.postgresql.org/docs/9.2/static/using-explain.html

There's a nestloop example about a third of the way down the page ...

			regards, tom lane


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2013-04-01 00:52 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-03-25 18:16 query plan estimate pg noob <pgnube@gmail.com>
2013-04-01 00:52 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox