Re: Logging affected rows

From: Raghavendra <raghavendra(dot)rao(at)enterprisedb(dot)com>
To: classical_89 <luongnx512(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Logging affected rows
Date: 2013-01-19 07:29:38
Message-ID: CA+h6Ahh0nmoBCv1hsHLgD+Cb66ZQ5gUcqJcU6xHULVUxX3Xm=A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Jan 19, 2013 at 12:53 PM, Raghavendra <
raghavendra(dot)rao(at)enterprisedb(dot)com> wrote:

> On Thu, Jan 17, 2013 at 9:18 AM, classical_89 <luongnx512(at)gmail(dot)com>wrote:
>
>> When i run a query , i just only want to the affected rows are logged to
>> log
>> file,What can i do ? .Is there a parameter in postgresql.conf to do that ?
>> .Thanks in advance
>>
>>
> AFAIK, I don't think we can log only affected rows of the query. But you
> can log the EXPLAIN ANALYZE output of the query which includes affected
> rows using AUTO_EXPLAIN contrib module.
>
> *Eg:-*
>
> postgres=# set auto_explain.log_analyze TO on;
> SET
> postgres=# load 'auto_explain';
> LOAD
> postgres=# select count(*) from cities ;
> count
> -------
> 2
> (1 row)
> *
> *
> *In logs:*
>
> 2012-12-06 03:27:57.104 IST [17410]: [78-1] db=postgres,user=postgres LOG:
> statement: select count(*) from cities ;
> 2012-12-06 03:27:57.105 IST [17410]: [79-1] db=postgres,user=postgres LOG:
> duration: 0.024 ms plan:
> Query Text: select count(*) from cities ;
> Aggregate (cost=1.02..1.03 rows=1 width=0) (actual
> time=0.015..0.015 rows=1 loops=1)
> Output: count(*)
> -> Seq Scan on public.cities (cost=0.00..1.02 rows=2 width=0)
> (actual time=0.009..0.010 *rows=2* loops=1)
> Output: city, location
>
>
Correction to my previous email, first you need to LOAD module and then
enable log_analyze. Copy/Paste mistake :)

--Raghav

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Reichstadt 2013-01-19 13:10:08 Cannot install postgres 9.2, less than 32 MB of memory
Previous Message Raghavendra 2013-01-19 07:23:40 Re: Logging affected rows