pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Config option log_statement
3+ messages / 2 participants
[nested] [flat]

* Config option log_statement
@ 2005-05-14 23:00  S Murthy Kambhampaty <smk_va@yahoo.com>
  0 siblings, 2 replies; 3+ messages in thread

From: S Murthy Kambhampaty @ 2005-05-14 23:00 UTC (permalink / raw)
  To: pgsql-admin

In postgresql 8.0, "create table <> as ..." statements
appear not to logged unless log_statement = 'all' in
postgresql.conf.  We are trying to reduce noise in the
logs from pgAdminIII and phpPgAdmin, but we use a lot
of 'create table <> as ...' queries that need to be
logged, and their duration tracked.  Is there a
combination of settings that will do the trick?  Can
postgresql be upgraded to log "create table <> as ..."
statements with log_statment = 'ddl' and/or
log_statment = 'mod'?

Thanks,
   Murthy


		
__________________________________ 
Yahoo! Mail Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [ADMIN] Config option log_statement
@ 2005-05-30 19:38  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: S Murthy Kambhampaty <smk_va@yahoo.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2005-05-30 19:38 UTC (permalink / raw)
  To: S Murthy Kambhampaty <smk_va@yahoo.com>; +Cc: PostgreSQL-patches <pgsql-patches@postgresql.org>

S Murthy Kambhampaty wrote:
> In postgresql 8.0, "create table <> as ..." statements
> appear not to logged unless log_statement = 'all' in
> postgresql.conf.  We are trying to reduce noise in the
> logs from pgAdminIII and phpPgAdmin, but we use a lot
> of 'create table <> as ...' queries that need to be
> logged, and their duration tracked.  Is there a
> combination of settings that will do the trick?  Can
> postgresql be upgraded to log "create table <> as ..."
> statements with log_statment = 'ddl' and/or
> log_statment = 'mod'?

Ah, I see I forgot about SELECT INTO when doing this for 8.0.  The
attached patch fixes it.  I will apply it to 8.0.X and CVS current. 
Thanks for the report.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/pgpatches/logstmt (text/plain, 1.3K) download Index: src/backend/tcop/postgres.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/tcop/postgres.c,v retrieving revision 1.444 diff -c -c -r1.444 postgres.c *** src/backend/tcop/postgres.c 24 May 2005 04:18:04 -0000 1.444 --- src/backend/tcop/postgres.c 30 May 2005 19:37:09 -0000 *************** *** 498,504 **** if (IsA(parsetree, PrepareStmt)) parsetree = (Node *) (((PrepareStmt *) parsetree)->query); ! if (IsA(parsetree, SelectStmt)) continue; /* optimization for frequent command */ if (log_statement == LOGSTMT_MOD && --- 498,505 ---- if (IsA(parsetree, PrepareStmt)) parsetree = (Node *) (((PrepareStmt *) parsetree)->query); ! if (IsA(parsetree, SelectStmt) && ! ((SelectStmt *) parsetree)->into == NULL) continue; /* optimization for frequent command */ if (log_statement == LOGSTMT_MOD && *************** *** 514,519 **** --- 515,521 ---- if ((log_statement == LOGSTMT_MOD || log_statement == LOGSTMT_DDL) && (strncmp(commandTag, "CREATE ", strlen("CREATE ")) == 0 || + IsA(parsetree, SelectStmt) || /* SELECT INTO, CREATE AS */ strncmp(commandTag, "ALTER ", strlen("ALTER ")) == 0 || strncmp(commandTag, "DROP ", strlen("DROP ")) == 0 || IsA(parsetree, GrantStmt) || /* GRANT or REVOKE */
^ permalink raw reply [nested|flat] 3+ messages in thread

* Re: [ADMIN] Config option log_statement
@ 2005-06-01 23:28  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: S Murthy Kambhampaty <smk_va@yahoo.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2005-06-01 23:28 UTC (permalink / raw)
  To: S Murthy Kambhampaty <smk_va@yahoo.com>; +Cc: PostgreSQL-patches <pgsql-patches@postgresql.org>


Fix applied.  It will appear in 8.0.X.  Patch attached.

---------------------------------------------------------------------------

S Murthy Kambhampaty wrote:
> In postgresql 8.0, "create table <> as ..." statements
> appear not to logged unless log_statement = 'all' in
> postgresql.conf.  We are trying to reduce noise in the
> logs from pgAdminIII and phpPgAdmin, but we use a lot
> of 'create table <> as ...' queries that need to be
> logged, and their duration tracked.  Is there a
> combination of settings that will do the trick?  Can
> postgresql be upgraded to log "create table <> as ..."
> statements with log_statment = 'ddl' and/or
> log_statment = 'mod'?
> 
> Thanks,
>    Murthy
> 
> 
> 		
> __________________________________ 
> Yahoo! Mail Mobile 
> Take Yahoo! Mail with you! Check email on your mobile phone. 
> http://mobile.yahoo.com/learn/mail 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/bjm/diff (text/plain, 1.3K) download Index: src/backend/tcop/postgres.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/tcop/postgres.c,v retrieving revision 1.440 diff -c -c -r1.440 postgres.c *** src/backend/tcop/postgres.c 31 Dec 2004 22:01:16 -0000 1.440 --- src/backend/tcop/postgres.c 1 Jun 2005 23:24:09 -0000 *************** *** 495,501 **** if (IsA(parsetree, PrepareStmt)) parsetree = (Node *) (((PrepareStmt *) parsetree)->query); ! if (IsA(parsetree, SelectStmt)) continue; /* optimization for frequent command */ if (log_statement == LOGSTMT_MOD && --- 495,502 ---- if (IsA(parsetree, PrepareStmt)) parsetree = (Node *) (((PrepareStmt *) parsetree)->query); ! if (IsA(parsetree, SelectStmt) && ! ((SelectStmt *) parsetree)->into == NULL) continue; /* optimization for frequent command */ if (log_statement == LOGSTMT_MOD && *************** *** 513,518 **** --- 514,520 ---- } commandTag = CreateCommandTag(parsetree); if (strncmp(commandTag, "CREATE ", strlen("CREATE ")) == 0 || + IsA(parsetree, SelectStmt) || /* SELECT INTO, CREATE AS */ strncmp(commandTag, "ALTER ", strlen("ALTER ")) == 0 || strncmp(commandTag, "DROP ", strlen("DROP ")) == 0 || IsA(parsetree, GrantStmt) || /* GRANT or REVOKE */
^ permalink raw reply [nested|flat] 3+ messages in thread


end of thread, other threads:[~2005-06-01 23:28 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-05-14 23:00 Config option log_statement S Murthy Kambhampaty <smk_va@yahoo.com>
2005-05-30 19:38 ` Bruce Momjian <pgman@candle.pha.pa.us>
2005-06-01 23:28 ` Bruce Momjian <pgman@candle.pha.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox