Re: Tracking SQLs that update data

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com>
Cc: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Tracking SQLs that update data
Date: 2010-06-19 20:12:37
Message-ID: AANLkTilFrS3VQYLoJDRc9qTgpVg32XM6GCwbv8kAKSPI@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Jun 19, 2010 at 5:28 AM, Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com> wrote:
>> It's far easier to adjust the logging.
>>
>> psql mydb
>> alter mydb set log_statement='mod';
>
>
>
> Thanks Scott.
>
> Two questions:
>
> 1. Will this log_statement='mod' be a permanent thing, or when I have
> done my testing and identifying the problem SQL, I can set it back to
> default so not too much logging is being done?

Just alter it back to 'none' when you're done. Note you can also set
it per user, so if it's a certain user you want to log you can only
log their statements.

> 2. After this statement, how or where do I find the culprit SQL?

They should be in the postgresql logs.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Goodenough 2010-06-19 21:56:15 A thought about other open source projects
Previous Message Teodor Macicas 2010-06-19 18:25:51 Re: Inserting additional data into pg_statistics