Обсуждение: [ADMIN] Displaying ProcessList to Users

Поиск
Список
Период
Сортировка

[ADMIN] Displaying ProcessList to Users

От
Günce Kaya
Дата:
Hi All,

I'm curious about can I display or list users who execute which queries in databases.

Any help would be appreciated.

Regards,
--
Gunce Kaya

Re: [ADMIN] Displaying ProcessList to Users

От
"Gunnar \"Nick\" Bluth"
Дата:
Am 05.01.2017 um 08:55 schrieb Günce Kaya:
> Hi All,

Hi Günce,


> I'm curious about can I display or list users who execute which queries
> in databases.
>
> Any help would be appreciated.

Have a look at pg_stat_activity.

Regards,
--
Gunnar "Nick" Bluth
DBA ELSTER

Tel:   +49 911/991-4665
Mobil: +49 172/8853339


Re: [ADMIN] Displaying ProcessList to Users

От
Günce Kaya
Дата:
Hi Gunnar,

When I select pg_stat_activity table, I can see only a row to my user but I have executed lots of queries. I can only see latest executed query to me. 

Is there any way to list users with whole queries that executed before by users?

Regards,

Gunce Kaya

2017-01-05 10:59 GMT+03:00 Gunnar "Nick" Bluth <gunnar.bluth.extern@elster.de>:
Am 05.01.2017 um 08:55 schrieb Günce Kaya:
> Hi All,

Hi Günce,


> I'm curious about can I display or list users who execute which queries
> in databases.
>
> Any help would be appreciated.

Have a look at pg_stat_activity.

Regards,
--
Gunnar "Nick" Bluth
DBA ELSTER

Tel:   +49 911/991-4665
Mobil: +49 172/8853339


--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



--
Gunce Kaya

Re: [ADMIN] Displaying ProcessList to Users

От
"Gunnar \"Nick\" Bluth"
Дата:
Am 05.01.2017 um 09:12 schrieb Günce Kaya:
> Hi Gunnar,

Hi Günce,

> When I select pg_stat_activity table, I can see only a row to my user
> but I have executed lots of queries. I can only see latest executed
> query to me.
>
> Is there any way to list users with whole queries that executed before
> by users?

Well, you'd need full statement logging to achieve that. And the
information will be in the log, not the DB:

https://www.postgresql.org/docs/current/static/runtime-config-logging.html#GUC-LOG-STATEMENT

Cheers,

Nick

>
> Regards,
>
> Gunce Kaya
>
> 2017-01-05 10:59 GMT+03:00 Gunnar "Nick" Bluth
> <gunnar.bluth.extern@elster.de <mailto:gunnar.bluth.extern@elster.de>>:
>
>     Am 05.01.2017 um 08:55 schrieb Günce Kaya:
>     > Hi All,
>
>     Hi Günce,
>
>
>     > I'm curious about can I display or list users who execute which queries
>     > in databases.
>     >
>     > Any help would be appreciated.
>
>     Have a look at pg_stat_activity.
>
>     Regards,
>     --
>     Gunnar "Nick" Bluth
>     DBA ELSTER
>
>     Tel:   +49 911/991-4665 <tel:%2B49%20911%2F991-4665>
>     Mobil: +49 172/8853339 <tel:%2B49%20172%2F8853339>
>
>
>     --
>     Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org
>     <mailto:pgsql-admin@postgresql.org>)
>     To make changes to your subscription:
>     http://www.postgresql.org/mailpref/pgsql-admin
>     <http://www.postgresql.org/mailpref/pgsql-admin>
>
>
>
>
> --
> Gunce Kaya


--
Gunnar "Nick" Bluth
DBA ELSTER

Tel:   +49 911/991-4665
Mobil: +49 172/8853339


Re: [ADMIN] Displaying ProcessList to Users

От
Günce Kaya
Дата:
Hi,

Thank you for your response. I modified some parameters in postgres.conf file like added log_line_prefix='%m %u@%d %r' and log_min_duration_statement=0 than I executed a script. So the result gave me what I need it. 

Thank you again. 

Regards,

Gunce Kaya

2017-01-05 11:32 GMT+03:00 Gunnar "Nick" Bluth <gunnar.bluth.extern@elster.de>:
Am 05.01.2017 um 09:12 schrieb Günce Kaya:
> Hi Gunnar,

Hi Günce,

> When I select pg_stat_activity table, I can see only a row to my user
> but I have executed lots of queries. I can only see latest executed
> query to me.
>
> Is there any way to list users with whole queries that executed before
> by users?

Well, you'd need full statement logging to achieve that. And the
information will be in the log, not the DB:

https://www.postgresql.org/docs/current/static/runtime-config-logging.html#GUC-LOG-STATEMENT

Cheers,

Nick

>
> Regards,
>
> Gunce Kaya
>
> 2017-01-05 10:59 GMT+03:00 Gunnar "Nick" Bluth
> <gunnar.bluth.extern@elster.de <mailto:gunnar.bluth.extern@elster.de>>:
>
>     Am 05.01.2017 um 08:55 schrieb Günce Kaya:
>     > Hi All,
>
>     Hi Günce,
>
>
>     > I'm curious about can I display or list users who execute which queries
>     > in databases.
>     >
>     > Any help would be appreciated.
>
>     Have a look at pg_stat_activity.
>
>     Regards,
>     --
>     Gunnar "Nick" Bluth
>     DBA ELSTER
>
>     Tel:   +49 911/991-4665 <tel:%2B49%20911%2F991-4665>
>     Mobil: +49 172/8853339 <tel:%2B49%20172%2F8853339>
>
>
>     --
>     Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org
>     <mailto:pgsql-admin@postgresql.org>)
>     To make changes to your subscription:
>     http://www.postgresql.org/mailpref/pgsql-admin
>     <http://www.postgresql.org/mailpref/pgsql-admin>
>
>
>
>
> --
> Gunce Kaya


--
Gunnar "Nick" Bluth
DBA ELSTER

Tel:   +49 911/991-4665
Mobil: +49 172/8853339


--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



--
Gunce Kaya