Re: Checking what is the current query running

From: "Shoaib Mir" <shoaibmir(at)gmail(dot)com>
To: Postgres <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Checking what is the current query running
Date: 2006-07-25 08:56:16
Message-ID: bf54be870607250156g2dd3b85dvf484014108294797@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

You have to enable "stats_command_string' in your postgresql.conf file:

stats_command_string = on

After that is done you can view queries running on database server like
this:

select current_query from pg_stat_activity;

You can also get the query execution times and which queries were run, in
the database server logs files by enabling the following in postgresql.conffile:

log_duration = on
log_statement = 'all'

Hope this helps...

Thanks,

Shoaib Mir
EnterpriseDB

On 7/25/06, Marco Bizzarri <marco(dot)bizzarri(at)gmail(dot)com> wrote:
>
> Hi all.
>
> I've a postgresql where sometimes a process can remaing running a
> query for a very long time.
>
> Aside from logging the queries, is there a way to know which query is
> running in one particular moment?
>
> Regards
> Marco
>
> --
> Marco Bizzarri
> http://notenotturne.blogspot.com/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Markus Wollny 2006-07-25 09:34:28 Re: Checking what is the current query running
Previous Message Shoaib Mir 2006-07-25 08:45:04 Re: problem backup/restore PSQL DB