Re: weird long time query

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Kaijiang Chen <chenkaijiang(at)gmail(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: weird long time query
Date: 2019-12-17 11:08:33
Message-ID: CAFj8pRAmdc9t84fEysmu_oN18YY18n6LUK3JGXV76TZyxqS-bw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general pgsql-performance

út 17. 12. 2019 v 11:45 odesílatel Kaijiang Chen <chenkaijiang(at)gmail(dot)com>
napsal:

> I'm using postgres 9.4.17 on centos 7.
> I check the running queries with the following SQL:
> SELECT
> procpid,
> start,
> now() - start AS lap,
> current_query
> FROM
> (SELECT
> backendid,
> pg_stat_get_backend_pid(S.backendid) AS procpid,
> pg_stat_get_backend_activity_start(S.backendid) AS start,
> pg_stat_get_backend_activity(S.backendid) AS current_query
> FROM
> (SELECT pg_stat_get_backend_idset() AS backendid) AS S
> ) AS S
> WHERE
> current_query <> '<IDLE>'
> ORDER BY
> lap DESC;
>

I think so this query is weird - probably this query was finished

you should to use constraint

WHERE state <> 'idle';

Regards

Pavel

> Then, I found a SQL that has run for some days (and still running):
> procpid | 32638
> start | 2019-11-25 16:29:29.529318+08
> lap | 21 days 18:24:54.707369
> current_query | DEALLOCATE pdo_stmt_00000388
>
> I tried to kill it with: SELECT pg_cancel_backend(32638) but it takes no
> effects.
>
> What's this query and what shall I do for it?
>
> Best Wishes
> Kaijiang
>
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message avinash varma 2019-12-17 11:34:18 Re: Planning time is high in Postgres 11.5 Compared with Postgres 10.11
Previous Message PG Bug reporting form 2019-12-17 09:51:38 BUG #16169: Default time output for 24:00 is 00:00

Browse pgsql-general by date

  From Date Subject
Next Message Steven Winfield 2019-12-17 16:12:07 Row locks, SKIP LOCKED, and transactions
Previous Message Andrei Zhidenkov 2019-12-17 08:41:47 Re: Race condition while creating a new partition

Browse pgsql-performance by date

  From Date Subject
Next Message Laurenz Albe 2019-12-17 13:08:39 Re: Consecutive Query Executions with Increasing Execution Time
Previous Message Andres Freund 2019-12-17 04:04:45 Re: Consecutive Query Executions with Increasing Execution Time