pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Jan Schulz <jasc@gmx.net>
To: pgsql-bugs@postgresql.org
Subject: Re: BUG #14948: cost overflow
Date: Tue, 12 Dec 2017 22:30:59 +0100
Message-ID: <942ec3b6-13ca-8e2b-d29f-520cdc0bf970@2ndquadrant.com> (raw)
In-Reply-To: <CAAc324iFOKF7WhffBncKxSUC7THiiwhCK0G9myav2BjOWzd2cQ@mail.gmail.com>
References: <20171205105924.27108.93509@wrigleys.postgresql.org>
	<28067.1512486620@sss.pgh.pa.us>
	<CAAc324hPZuLJiwQK_zVxEp3PEcpxpgnee-hxD55jUVp=x2hhCA@mail.gmail.com>
	<29106.1512509416@sss.pgh.pa.us>
	<CAAc324ivGt6w6iRxh-TFSu7MDNeQB+VQppN8QpOzxGiHJSD9Rw@mail.gmail.com>
	<CAAc324iFOKF7WhffBncKxSUC7THiiwhCK0G9myav2BjOWzd2cQ@mail.gmail.com>



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




view thread (11+ messages)

Message-ID: <942ec3b6-13ca-8e2b-d29f-520cdc0bf970@2ndquadrant.com>
Permalink:  ../942ec3b6-13ca-8e2b-d29f-520cdc0bf970@2ndquadrant.com/
Also on:    postgresql.org/message-id/942ec3b6-13ca-8e2b-d29f-520cdc0bf970@2ndquadrant.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tomas.vondra@2ndquadrant.com, jasc@gmx.net
  Subject: Re: BUG #14948: cost overflow
  In-Reply-To: <942ec3b6-13ca-8e2b-d29f-520cdc0bf970@2ndquadrant.com>
  References: <20171205105924.27108.93509@wrigleys.postgresql.org> <28067.1512486620@sss.pgh.pa.us> <CAAc324hPZuLJiwQK_zVxEp3PEcpxpgnee-hxD55jUVp=x2hhCA@mail.gmail.com> <29106.1512509416@sss.pgh.pa.us> <CAAc324ivGt6w6iRxh-TFSu7MDNeQB+VQppN8QpOzxGiHJSD9Rw@mail.gmail.com> <CAAc324iFOKF7WhffBncKxSUC7THiiwhCK0G9myav2BjOWzd2cQ@mail.gmail.com> <942ec3b6-13ca-8e2b-d29f-520cdc0bf970@2ndquadrant.com>

* 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