Re: Whether to back-patch fix for aggregate transtype width estimates - Mailing list pgsql-hackers

From Greg Stark
Subject Re: Whether to back-patch fix for aggregate transtype width estimates
Date
Msg-id CAM-w4HPchTTZS6+Z-WOi_THNhdR=H4YNYuZgRrAi3BEDTorPCw@mail.gmail.com
Whole thread Raw
In response to Re: Whether to back-patch fix for aggregate transtype width estimates  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sat, Jun 18, 2016 at 5:14 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> .  In 9.x, that's broken and it falls back to
> get_typavgwidth's default guess of 32 bytes.  If what you've actually
> got is, say, varchar(255) and most of the entries actually approach
> that length, this could result in a drastic underestimate, possibly
> leading to OOM from hash table growth.


This seems more likely to result in the converse. 32 bytes is enough
distinct values I imagine it's going to avoid a hash join. (and In any
case if you have a varchar(n) where n>32 then it's probably a bad bet
to assume n gives much information about the typical length of the
strings). On the other hand if what you've actually got is a
varchar(1) or something like that then indeed a hash join might have
been a good choice.

-- 
greg



pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: 10.0
Next
From: Peter Eisentraut
Date:
Subject: Re: parallel.c is not marked as test covered