pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: pg_stat_activity
Date: Mon, 11 Jun 2018 08:56:43 -0500
Message-ID: <9884a24a-c129-a1a9-1901-2a9c8987331e@gmail.com> (raw)
In-Reply-To: <CAGDYbUM0Lv-fcFp_Mh4jyBtSrW24Z1psvey6FBi5q=LQx=7CMQ@mail.gmail.com>
References: <4405957b-2e0f-bfc5-eaf6-5e2864da2796@gmail.com>
	<CAGDYbUM0Lv-fcFp_Mh4jyBtSrW24Z1psvey6FBi5q=LQx=7CMQ@mail.gmail.com>

Thanks.

How, then, do I get only long-running SELECT statements?

I've tried this (since I don't want to inadvertently get other DML & DDL 
statements which might have "select" in a field name), but CTEs and queries 
that start with a comment slip by this filter.

FROM pg_stat_activity
WHERE state <> 'idle'
   AND SUBSTRING(UPPER(query) FROM 1 FOR 6) = 'SELECT';

Thanks

On 06/11/2018 08:47 AM, Shreeyansh Dba wrote:
> Ron,
>
> Yes, It can list the insert,delete and update statement as well..
>
> <http://www.shreeyansh.com;
>
> On Mon, Jun 11, 2018 at 7:07 PM, Ron <ronljohnsonjr@gmail.com 
> <mailto:ronljohnsonjr@gmail.com>> wrote:
>
>     Hi,
>
>     Does pg_stat_activity only list SELECT statements, or does it also
>     list INSERT, DELETE and UPDATE statements?
>
>

-- 
Angular momentum makes the world go 'round.

view thread (23+ messages)  latest in thread

Message-ID: <9884a24a-c129-a1a9-1901-2a9c8987331e@gmail.com>
Permalink:  ../9884a24a-c129-a1a9-1901-2a9c8987331e@gmail.com/
Also on:    postgresql.org/message-id/9884a24a-c129-a1a9-1901-2a9c8987331e@gmail.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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: pg_stat_activity
  In-Reply-To: <9884a24a-c129-a1a9-1901-2a9c8987331e@gmail.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