pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tv@fuzzy.cz>
To: pgsql-performance@postgresql.org
Subject: Re: queries with DISTINCT / GROUP BY giving different plans
Date: Wed, 21 Aug 2013 00:21:24 +0200
Message-ID: <5213EBE4.5030302@fuzzy.cz> (raw)
In-Reply-To: <13875.1377032529@sss.pgh.pa.us>
References: <3a56c4d2c0b2daa11a625c2983823901.squirrel@sq.gransy.com>
	<11586.1376505314@sss.pgh.pa.us>
	<520E7F33.7010305@fuzzy.cz>
	<7059.1377015896@sss.pgh.pa.us>
	<5213ADB1.3040807@fuzzy.cz>
	<13875.1377032529@sss.pgh.pa.us>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

On 20.8.2013 23:02, Tom Lane wrote:
> Tomas Vondra <tv@fuzzy.cz> writes:
> 
>> Anyway, I still don't understand why the same logic around 
>> hash_agg_entry_size should not apply to choose_hashed_grouping as
>> well? Well, it would make it slower in this particular corner case,
>> but wouldn't it be more correct?

Meh, I meant it the other way around - applying the hashentrysize logic
from hashed_grouping to hashed_distinct. So that both use 56B.

> choose_hashed_grouping has it right, or at least more nearly right. 
> choose_hashed_distinct is simply failing to account for space that 
> will in fact be consumed.  Not fixing that is not a good way to deal
> with inaccurate number-of-groups estimates; if that estimate is low
> rather than high, the consequences will be a lot worse than they are
> here.

Not quite sure how to parse this (not a native speaker here, sorry).
Does that mean we want to keep it as it is now (because fixing it would
cause even worse errors with low estimates)? Or do we want to fix
hashed_distinct so that it behaves like hashed_grouping?

Tomas


-- 
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 (10+ messages)  latest in thread

Message-ID: <5213EBE4.5030302@fuzzy.cz>
Permalink:  ../5213EBE4.5030302@fuzzy.cz/
Also on:    postgresql.org/message-id/5213EBE4.5030302@fuzzy.cz

 · 

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: tv@fuzzy.cz
  Subject: Re: queries with DISTINCT / GROUP BY giving different plans
  In-Reply-To: <5213EBE4.5030302@fuzzy.cz>

* 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