From: Tomas Vondra <tv@fuzzy.cz>
To: Christophe Pettus <xof@thebuild.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: 7k records into Sort node, 4.5m out?
Date: Tue, 14 Aug 2012 03:35:21 +0200
Message-ID: <dda48e8e4cd63cc6f98f9eca78016c05.squirrel@sq.gransy.com> (raw)
In-Reply-To: <D2CA9292-023A-4DF4-82B8-6E99CE82CCB1@thebuild.com>
References: <D2CA9292-023A-4DF4-82B8-6E99CE82CCB1@thebuild.com>
On 14 Srpen 2012, 3:15, Christophe Pettus wrote:
> Consider this EXPLAIN ANALYZE output:
>
> http://explain.depesz.com/s/TCi
>
> Note the Bitmap Heap Scan at the bottom claims to be producing 7094 rows,
> and the Sort above it expects to be processing 7330 rows (the same number
> the Bitmap Heap Scan expected to produce)... but the sort is actually
> producing 4512231 rows, which the sort time would indicate is what really
> happened. How can this be?
Hi,
notice there's a merge join right above the sort. If there are duplicate
values in the first table (charlie in the explain plans), the matching
rows from the sort will be read repeatedly (re-scanned) and thus counted
multiple times.
Tomas
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: tv@fuzzy.cz, xof@thebuild.com
Subject: Re: 7k records into Sort node, 4.5m out?
In-Reply-To: <dda48e8e4cd63cc6f98f9eca78016c05.squirrel@sq.gransy.com>
* 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