Tracing SQL statements that run against my DB

Lists: pgsql-admin
From: Lucky Shag <luckyshag69(at)gmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Tracing SQL statements that run against my DB
Date: 2010-09-11 19:46:43
Message-ID: AANLkTi=_ryfjp6Hfgd-nnaUAfR8jNzen+b8xbMscQAoM@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

Hi,

I am running Postgres 8.4 on Windows 7.

I would like to view the SQL statements that are run against the database.

What parameter do I need to set where, and where is trace output written?

Thank you very much for your help.


From: Vibhor Kumar <vibhor(dot)aim(at)gmail(dot)com>
To: Lucky Shag <luckyshag69(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Tracing SQL statements that run against my DB
Date: 2010-09-12 03:49:03
Message-ID: 8A3FD0B8-32D8-4A00-A9C7-DD54F62EA0A4@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin


On Sep 12, 2010, at 1:16 AM, Lucky Shag wrote:

> I am running Postgres 8.4 on Windows 7.
>
> I would like to view the SQL statements that are run against the database.
>
> What parameter do I need to set where, and where is trace output written?
>

you can use log_statement. Setting this parameter, postgresql will write the SQL in postgresql log files.
For more information, follow the link given below:
http://www.postgresql.org/docs/8.4/static/runtime-config-logging.html#GUC-LOG-STATEMENT

Thanks & Regards,
Vibhor Kumar (PCP & OCP)
ITIL V3 Cerftified.