Re: Two division by 0 errors in optimizer/plan/planner.c and optimizer/path/costsize.c

From: Piotr Stefaniak <postgres(at)piotr-stefaniak(dot)me>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Two division by 0 errors in optimizer/plan/planner.c and optimizer/path/costsize.c
Date: 2016-03-26 18:29:25
Message-ID: BLU437-SMTP95EEBC8DD06F30A375ECDFF2840@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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;

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Regina Obe 2016-03-26 18:30:16 Re: Can we amend gitignore so git postgresql works with git on windows using Msys/Mingw64
Previous Message Regina Obe 2016-03-26 18:11:58 Re: If a schema is created as part of an extension, should all user created tables created in that schema be considered part of the extension?