On Tue, Jun 26, 2018 at 1:26 PM, amandeep singh <singh_a@xxxxxxx> wrote:
Hi Andreas
The value for $1 is same in all queries.
@Edson: number of such running queries are always 3.
From: Andreas Kretschmer
Sent: Tuesday, 26 June, 6:04 PM
Subject: Re: We find few queries running three times simultaneously with same parameters on postgres db
On 26 June 2018 12:32:44 CEST, Andreas Kretschmer wrote: > > >Am 26.06.2018 um 12:19 schrieb amandeep singh: >> We have been observing our postgres database from past few days,We >> found few queries running three times simultaneously with same >> parameters.I would like to back track how a query is running multiple > >> times. > >they are independend each other. You can run those queries with EXPLAIN > >ANALYSE to see the execution plan. > >Regards, Andreas seems like i misunderstud your query. are you sure, that the parameter $1 is equal across all different connections? Andreas -- 2ndQuadrant - The PostgreSQL Support Company
This query will show you the pid, client_addr and user that submitted the queries, in addition to other useful information.
SELECT backend_start as be_start,
datname,
pid as pid,
client_addr,
usename as user,
state,
query,
wait_event_type,
query_start,
current_timestamp - query_start as duration
FROM pg_stat_activity
WHERE pg_backend_pid() <> pid
ORDER BY 1,
datname,
query_start;
datname,
pid as pid,
client_addr,
usename as user,
state,
query,
wait_event_type,
query_start,
current_timestamp - query_start as duration
FROM pg_stat_activity
WHERE pg_backend_pid() <> pid
ORDER BY 1,
datname,
query_start;
--
Melvin Davidson
Maj. Database & Exploration Specialist
Universe Exploration Command – UXC
Employment by invitation only!
Maj. Database & Exploration Specialist
Universe Exploration Command – UXC
Employment by invitation only!