pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: vahe.evoyan@gmail.com
Cc: pgsql-performance@postgresql.org
Subject: Re: Wrong actual number of rows in the Query Plan
Date: Thu, 28 Feb 2013 12:58:49 -0500
Message-ID: <8621.1362074329@sss.pgh.pa.us> (raw)
In-Reply-To: <CAETCRjg_3kp-MniE6ZmEH4ZMSE4xiSD=01vsuXrQae4Yxwq32Q@mail.gmail.com>
References: <CAETCRjg_3kp-MniE6ZmEH4ZMSE4xiSD=01vsuXrQae4Yxwq32Q@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

Vahe Evoyan <vahe.evoyan@gmail.com> writes:
>  Merge Join  (cost=0.00..2513.96 rows=1 width=72) (actual
> time=127.361..473.687 rows=66460 loops=1)
>    Merge Cond: ((v1.dft_id = v2.dft_id) AND ((v1.key)::text =
> (v2.key)::text))
>    ->  Index Scan using qor_value_self_join on qor_value v1
> (cost=0.00..1255.60 rows=275 width=51) (actual time=89.549..97.045
> rows=1388 loops=1)
>          Index Cond: ((run_id = 60807) AND (stat_id = 342))
>    ->  Index Scan using qor_value_self_join on qor_value v2
> (cost=0.00..1255.60 rows=275 width=51) (actual time=37.796..134.286
> rows=66343 loops=1)
>          Index Cond: ((run_id = 60875) AND (stat_id = 342))
>  Total runtime: 544.646 ms
> (7 rows)

> Note that the second Index Scan has 66343 rows in place of 1388.

That's not a bug.  That's a result of rescanning portions of the inner
relation's output due to duplicate mergejoin keys in the outer relation.
The EXPLAIN ANALYZE machinery counts the re-fetches as if they were new
rows, though in some sense they're not.

			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



view thread (2+ messages)

Message-ID: <8621.1362074329@sss.pgh.pa.us>
Permalink:  ../8621.1362074329@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8621.1362074329@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, vahe.evoyan@gmail.com
  Subject: Re: Wrong actual number of rows in the Query Plan
  In-Reply-To: <8621.1362074329@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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