Re: syslog output from explain looks weird... - Mailing list pgsql-hackers

From Larry Rosenman
Subject Re: syslog output from explain looks weird...
Date
Msg-id 20001122165421.A12825@lerami.lerctr.org
Whole thread Raw
In response to Re: syslog output from explain looks weird...  (Larry Rosenman <ler@lerctr.org>)
Responses Re: syslog output from explain looks weird...  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
* Larry Rosenman <ler@lerctr.org> [001122 15:25]:
> * Larry Rosenman <ler@lerctr.org> [001122 15:03]:
> > Just playing with the syslog functionality on 7.1devel, and the
> > explain output looks weird to me:
> > 
> > Nov 22 14:58:44 lerami pg-test[4005]: [2] DEBUG:  MoveOfflineLogs:
> > skip 0000000000000006
> > Nov 22 14:58:44 lerami pg-test[4005]: [3] DEBUG:  MoveOfflineLogs:
> > skip 0000000000000005
> > Nov 22 14:59:09 lerami pg-test[4005]: [4] NOTICE:  QUERY PLAN:
> > Nov 22 14:59:0 lerami Nov 22 14:59:09Index Scan using upslog_index on
> > upslog  (cost=0.00..88.65 rows=165 width=28)
> > 
> > seems like it should be better. 
> > 
> > The output at the client looks fine:
> > ler=# explain select * from upslog where upslogdate >='2000-11-01';
> > NOTICE:  QUERY PLAN:
> > 
> > Index Scan using upslog_index on upslog  (cost=0.00..88.65 rows=165
> > width=28)
> > 
> > EXPLAIN
> > ler=# 
> And here is a fix.  What appears to piss off my syslogd is the no
> character lines.  So, I added spaces to the output.  The new client
> output looks like:
> ler=# explain select * from upslog where upslogdate>='2000-11-01';
> NOTICE:  QUERY PLAN:
>  
>  Index Scan using upslog_index on upslog  (cost=0.00..88.65 rows=165
> width=28)
> 
> EXPLAIN
> ler=# \q
> $ 
> 
> and the syslog looks like:
> Nov 22 15:22:56 lerami pg-test[8299]: [2] NOTICE:  QUERY PLAN:
> Nov 22 15:22:56 lerami 
> Nov 22 15:22:56 lerami Index Scan using upslog_index on upslog
> (cost=0.00..88.65 rows=165 width=28)
> 
Looking some more, I found some other places that need a space (I
suspect...), so here is an updated patch.

Index: src/backend/commands/explain.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/commands/explain.c,v
retrieving revision 1.62
diff -c -r1.62 explain.c
*** src/backend/commands/explain.c    2000/11/12 00:36:56    1.62
--- src/backend/commands/explain.c    2000/11/22 22:52:39
***************
*** 110,116 ****         s = nodeToString(plan);         if (s)         {
!             elog(NOTICE, "QUERY DUMP:\n\n%s", s);             pfree(s);         }     }
--- 110,116 ----         s = nodeToString(plan);         if (s)         {
!             elog(NOTICE, "QUERY DUMP:\n \n %s", s);             pfree(s);         }     }
***************
*** 120,126 ****         s = Explain_PlanToString(plan, es);         if (s)         {
!             elog(NOTICE, "QUERY PLAN:\n\n%s", s);             pfree(s);         }     }
--- 120,126 ----         s = Explain_PlanToString(plan, es);         if (s)         {
!             elog(NOTICE, "QUERY PLAN:\n \n %s", s);             pfree(s);         }     }
***************
*** 149,155 ****      if (plan == NULL)     {
!         appendStringInfo(str, "\n");         return;     } 
--- 149,155 ----      if (plan == NULL)     {
!         appendStringInfo(str, "\n ");         return;     } 
***************
*** 283,289 ****                          plan->startup_cost, plan->total_cost,
plan->plan_rows,plan->plan_width);     }
 
!     appendStringInfo(str, "\n");      /* initPlan-s */     if (plan->initPlan)
--- 283,289 ----                          plan->startup_cost, plan->total_cost,
plan->plan_rows,plan->plan_width);     }
 
!     appendStringInfo(str, "\n ");      /* initPlan-s */     if (plan->initPlan)
***************
*** 293,299 ****          for (i = 0; i < indent; i++)             appendStringInfo(str, "  ");
!         appendStringInfo(str, "  InitPlan\n");         foreach(lst, plan->initPlan)         {             es->rtable
=((SubPlan *) lfirst(lst))->rtable;
 
--- 293,299 ----          for (i = 0; i < indent; i++)             appendStringInfo(str, "  ");
!         appendStringInfo(str, "  InitPlan\n ");         foreach(lst, plan->initPlan)         {             es->rtable
=((SubPlan *) lfirst(lst))->rtable;
 
***************
*** 369,375 ****          for (i = 0; i < indent; i++)             appendStringInfo(str, "  ");
!         appendStringInfo(str, "  SubPlan\n");         foreach(lst, plan->subPlan)         {             es->rtable =
((SubPlan*) lfirst(lst))->rtable;
 
--- 369,375 ----          for (i = 0; i < indent; i++)             appendStringInfo(str, "  ");
!         appendStringInfo(str, "  SubPlan\n ");         foreach(lst, plan->subPlan)         {             es->rtable =
((SubPlan*) lfirst(lst))->rtable;
 
-- 
Larry Rosenman                      http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


pgsql-hackers by date:

Previous
From: "Mikheev, Vadim"
Date:
Subject: RE: Talkative initdb, elog message levels
Next
From: jmscott@popmail.com
Date:
Subject: Re: Table/Column Constraints