pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Arnaud Lesauvage <arnaud.listes@codata.eu>
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Cannot terminate backend
Date: Fri, 31 Mar 2023 13:46:39 +0000
Message-ID: <MRZP264MB2889C8F4000BE1B7EE85164A808F9@MRZP264MB2889.FRAP264.PROD.OUTLOOK.COM> (raw)

Hi all,

I have a long running query that I seem unable to either cancel or terminate.
What could be the reason for this, and what is the bet way to terminate this kind of query ?

The query is a CTE using postgis ST_ClusterDBSCAN function. The CTE returns approximately 150k rows.
The SQL is as follows :

EXPLAIN ANALYZE

WITH subq AS (

        SELECT id, geom, ST_ClusterDBSCAN(geom, eps := 1000, minpoints := 1) OVER() AS cluster_id
        FROM mytable
)

SELECT cluster_id, count(id), ST_Collect(geom)

FROM subq

GROUP BY cluster_id;


pg_stat_activity show no wait event.
pg_cancel_backend(mypid) returns true but the state does not change in pg_stat_activity.
pg_terminate_backend(mypid) yields the same result (as superuser)
Pg_stat_activity show no wait_event.


SELECT version();

PostgreSQL 14.5 (Ubuntu 14.5-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit


Any idea ? Thanks a lot !

Regards
Arnaud


view thread (5+ messages)  latest in thread

Message-ID: <MRZP264MB2889C8F4000BE1B7EE85164A808F9@MRZP264MB2889.FRAP264.PROD.OUTLOOK.COM>
Permalink:  ../MRZP264MB2889C8F4000BE1B7EE85164A808F9@MRZP264MB2889.FRAP264.PROD.OUTLOOK.COM/
Also on:    postgresql.org/message-id/MRZP264MB2889C8F4000BE1B7EE85164A808F9@MRZP264MB2889.FRAP264.PROD.OUTLOOK.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-general@postgresql.org
  Cc: arnaud.listes@codata.eu
  Subject: Re: Cannot terminate backend
  In-Reply-To: <MRZP264MB2889C8F4000BE1B7EE85164A808F9@MRZP264MB2889.FRAP264.PROD.OUTLOOK.COM>
  References: <MRZP264MB2889C8F4000BE1B7EE85164A808F9@MRZP264MB2889.FRAP264.PROD.OUTLOOK.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