Re: [GENERAL] query log corrupted-looking entries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "George Pavlov" <gpavlov(at)mynewplace(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [GENERAL] query log corrupted-looking entries
Date: 2006-10-18 20:17:24
Message-ID: 29860.1161202644@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message George Pavlov 2006-10-18 20:22:52 Re: [GENERAL] query log corrupted-looking entries
Previous Message Brad Nicholson 2006-10-18 20:05:42 Re: Stats Collector Won't Start

Browse pgsql-hackers by date

  From Date Subject
Next Message George Pavlov 2006-10-18 20:22:52 Re: [GENERAL] query log corrupted-looking entries
Previous Message Simon Riggs 2006-10-18 19:02:18 Re: pg_internal.init is hazardous to your health