pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: George Pavlov <gpavlov@mynewplace.com>
Cc: pgsql-hackers@postgreSQL.org
Subject: Re: [GENERAL] query log corrupted-looking entries
Date: Wed, 18 Oct 2006 16:17:24 -0400
Message-ID: <29860.1161202644@sss.pgh.pa.us> (raw)
In-Reply-To: <11790.1161119352@sss.pgh.pa.us>
References: <8C5B026B51B6854CBE88121DBF097A8651DDE7@ehost010-33.exch010.intermedia.net>
	<11790.1161119352@sss.pgh.pa.us>

I wrote:
> I checked around with some kernel/glibc gurus in Red Hat, and the
> consensus seemed to be that we'd be better off to bypass fprintf() and
> just send message strings to stderr using write() --- ie, instead of
> elog.c doing
>             fprintf(stderr, "%s", buf.data);
> do
>             write(fileno(stderr), buf.data, strlen(buf.data));

I did some strace'ing of the backend, and observed that even for very
long messages (upwards of 100K) the fprintf results in a single write()
call.  This was true on both Fedora Core 5 and a pretty old HPUX version.
So it'd seem that most versions of libc already know about optimizing
fprintf-%s into a direct write(), and changing our code wouldn't change
the behavior.  It'd be interesting to verify whether it's the same on
George's machine though.

			regards, tom lane



view thread (30+ messages)  latest in thread

Message-ID: <29860.1161202644@sss.pgh.pa.us>
Permalink:  ../29860.1161202644@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29860.1161202644@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gpavlov@mynewplace.com
  Subject: Re: [GENERAL] query log corrupted-looking entries
  In-Reply-To: <29860.1161202644@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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