I'm not saying this is necessarily a bug since the whole function deals with floats, but perhaps it's interesting to note that ndistinct can be 0 in src/backend/utils/adt/selfuncs.c:estimate_hash_bucketsize:
        /*
         * Initial estimate of bucketsize fraction is 1/nbuckets as long as the
         * number of buckets is less than the expected number of distinct 
values;
         * otherwise it is 1/ndistinct.
         */
        if (ndistinct > nbuckets)
                estfract = 1.0 / nbuckets;
        else
                estfract = 1.0 / ndistinct;

for this query:
select subq_0.c1 as c0
from (
select ref_0.a as c0, (select NULL::integer from information_schema.user_defined_types limit 1 offset 1) as c1
  from public.rtest_nothn3 as ref_0
  limit 130
) as subq_0
left join (
  select sample_0.x as c0
  from public.insert_tbl as sample_0
  where false
) as subq_1 on subq_0.c1 = subq_1.c0;


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to