Re: BUG #14948: cost overflow - Mailing list pgsql-bugs

From Tomas Vondra
Subject Re: BUG #14948: cost overflow
Date
Msg-id 942ec3b6-13ca-8e2b-d29f-520cdc0bf970@2ndquadrant.com
Whole thread Raw
In response to Re: BUG #14948: cost overflow  (Jan Schulz <jasc@gmx.net>)
List pgsql-bugs

On 12/12/2017 02:54 PM, Jan Schulz wrote:
> Hello,
> 
> in the meantime we managed to not trigger the OOM kill anymore and now
> also don't have this problem with the negative costs anymore. We still
> have one staging environment where this error is present, but we would
> like to reclaim it. Is there some guidelines I can follow to debug
> this?
> 

I think you're probably looking for this:

https://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Linux/BSD

Once you have GDB attached to the process, you can set breakpoints on
interesting places.

I believe the most interesting function to inspect is btcostestimate,
which is what produces estimates for the bitmap index scans:

https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/selfuncs.c#L6880

In particular, we're interested in parameter values passed to the
function, when it produces negative indexTotalCost (..-12884901880.97).
The value is updated on multiple places in the function, so you'll need
to step through and see at which point it gets negative.

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-bugs by date:

Previous
From: Petar Barzakov
Date:
Subject: Re: BUG #14955: postgresql10-server-10.1-3PGDG.rhel6 initdb isssue
Next
From: prabakaranbc@gmail.com
Date:
Subject: BUG #14970: Foreign Data Wrapper for windows