From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jon Nelson <jnelson+pgsql@jamponi.net>
Cc: pgsql-performance@postgresql.org
Subject: Re: bad plan: 8.4.8, hashagg, work_mem=1MB.
Date: Mon, 20 Jun 2011 12:08:19 -0400
Message-ID: <6961.1308586099@sss.pgh.pa.us> (raw)
In-Reply-To: <BANLkTinbiNfgkXLf-1rDOGPdbXdS7tLt8w@mail.gmail.com>
References: <BANLkTinbiNfgkXLf-1rDOGPdbXdS7tLt8w@mail.gmail.com>
Jon Nelson <jnelson+pgsql@jamponi.net> writes:
> I ran a query recently where the result was very large. The outer-most
> part of the query looked like this:
> HashAggregate (cost=56886512.96..56886514.96 rows=200 width=30)
> -> Result (cost=0.00..50842760.97 rows=2417500797 width=30)
> The row count for 'Result' is in the right ballpark, but why does
> HashAggregate think that it can turn 2 *billion* rows of strings (an
> average of 30 bytes long) into only 200?
200 is the default assumption about number of groups when it's unable to
make any statistics-based estimate. You haven't shown us any details so
it's hard to say more than that.
regards, tom lane
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, jnelson+pgsql@jamponi.net
Subject: Re: bad plan: 8.4.8, hashagg, work_mem=1MB.
In-Reply-To: <6961.1308586099@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