pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jurrie Overgoor <postgresql-mailinglist@jurr.org>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Cc: Vijaykumar Jain <vijaykumarjain.github@gmail.com>
Subject: Re: How to debug a connection that's "active" but hanging?
Date: Mon, 12 Jul 2021 13:46:30 -0400
Message-ID: <2985639.1626111990@sss.pgh.pa.us> (raw)
In-Reply-To: <eb266d47-dd5c-3622-aa5a-fd45ed71d9de@jurr.org>
References: <e15b9bf5-4d1f-5abd-5e71-78894bea4916@jurr.org>
	<CAM+6J97mNj4gFnC=wYpsy5L+igEE8gwifVhaoXm-BE8BYX2PPQ@mail.gmail.com>
	<eb266d47-dd5c-3622-aa5a-fd45ed71d9de@jurr.org>

Jurrie Overgoor <postgresql-mailinglist@jurr.org> writes:
> Hi Vijaykumar, thanks for replying. Yes, this is reproducible. About 50% 
> of the times, my connection is hanging. It's always on the same query, 
> which I shared in the previous post.

The backtraces you captured look like the query is not "hung", it's
just computing away.

A plausible interpretation of the facts you've given is that the
query's plan is unstable, and sometimes the server is choosing a plan
that takes much longer to run than other times.  Ordinarily I'd suggest
that the auto_explain extension might help you debug that, but I think
it only works on queries that do eventually complete.  You might need
to investigate by altering your application to capture "EXPLAIN ..."
output just before the troublesome query, so you can see if it gets
a different plan in the slow cases.

			regards, tom lane





view thread (8+ messages)  latest in thread

Message-ID: <2985639.1626111990@sss.pgh.pa.us>
Permalink:  ../2985639.1626111990@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2985639.1626111990@sss.pgh.pa.us

 · 

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-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, postgresql-mailinglist@jurr.org, vijaykumarjain.github@gmail.com
  Subject: Re: How to debug a connection that's "active" but hanging?
  In-Reply-To: <2985639.1626111990@sss.pgh.pa.us>
  References: <e15b9bf5-4d1f-5abd-5e71-78894bea4916@jurr.org> <CAM+6J97mNj4gFnC=wYpsy5L+igEE8gwifVhaoXm-BE8BYX2PPQ@mail.gmail.com> <eb266d47-dd5c-3622-aa5a-fd45ed71d9de@jurr.org> <2985639.1626111990@sss.pgh.pa.us>

* 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