pg_catalog.pg_stat_activity and current_query - Mailing list pgsql-general

From Alex
Subject pg_catalog.pg_stat_activity and current_query
Date
Msg-id cb45f32a-9b25-4402-afb6-fd63a58b6f75@v31g2000vbs.googlegroups.com
Whole thread Raw
Responses Re: pg_catalog.pg_stat_activity and current_query  (Szymon Guz <mabewlun@gmail.com>)
List pgsql-general
Good morning,

I'm trying to make a Postgre profiler reading
pg_catalog.pg_stat_activity.
But when I read that view... I always find my query.

Example:

ResultSet rs = st.executeQuery("SELECT query_start,current_query FROM
pg_catalog.pg_stat_activity where xact_start is not null");
while(rs.next()) {
  String sQuery = rs.getString("current_query");
  qStart = rs.getTimestamp("query_start");
  if(!qStart.equals(qStart_last)){
    display.append(sQuery+'\n');
    qStart_last=(Timestamp)qStart.clone();
  }
}

Always prints "SELECT query_start,current_query FROM
pg_catalog.pg_stat_activity where xact_start is not null" :)

I'd like to discard my query... any ideas?

Thanks

pgsql-general by date:

Previous
From: Orhan Kavrakoglu
Date:
Subject: Re: how to avoid repeating expensive computation in select
Next
From: Szymon Guz
Date:
Subject: Re: pg_catalog.pg_stat_activity and current_query