Re: Logical Replication: SELECT pg_catalog.set_config Statement

From: Jeremy Smith <jeremy(at)musicsmith(dot)net>
To: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Logical Replication: SELECT pg_catalog.set_config Statement
Date: 2021-05-18 15:52:16
Message-ID: CAM8SmLXYkrHJ=6DMOTv8nYbRAPhANmUSEK6Z8cCT34R61EooKw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> We found out because we are monitoring long running queries, and saw it
> had been running for a month before the restart yesterday.
> I just queried pg_stat_activity and it seems to be running since then.
>
> taimusz=# SELECT pid, query_start, usename, left(query,70)
> FROM pg_stat_activity
> WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
> ORDER BY query_start;
> pid | query_start | usename
> | left
>
> ---------+-------------------------------+------------+------------------------------------------------------------------------
> 2321161 | 2021-05-17 16:15:13.906679+02 | subscriber | SELECT
> pg_catalog.set_config('search_path', '', false);
>
>
>
You should add: AND state != 'idle' to filter out queries that are no
longer running and don't have an open transaction. Your query is finding
long running sessions, not necessarily long running queries.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bryn Llewellyn 2021-05-19 06:22:44 Some abbrev values from pg_timezone_names are not found in pg_timezone_abbrevs
Previous Message David G. Johnston 2021-05-18 13:50:46 Re: