Re: Wierd memory problem with Apache / PHP. Related to

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <jdavis-pgsql(at)empires(dot)org>
Cc: Michael Ben-Nes <miki(at)canaan(dot)co(dot)il>, postgresql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Wierd memory problem with Apache / PHP. Related to
Date: 2005-02-02 15:56:06
Message-ID: 28954.1107359766@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jeff Davis <jdavis-pgsql(at)empires(dot)org> writes:
> Developers: am I mistaken about libpq copying the entire query before
> sending it to the backend? Is there a reason that libpq wouldn't just
> send it along to the backend?

That's a feature, not a bug. libpq marshals whole messages before
sending them so that it can be sure it doesn't have a problem with
a half-sent message. The only way out of such a problem would be to
drop the connection, because there's no way to regain message boundary
sync with the backend.

If your SQL queries are so long as to pose a memory threat by
themselves, you might want to rethink your approach anyway. I'd
expect such things to hit bottlenecks all over the place. In particular
the backend is quite certain to make multiple copies of any long literal
constant during parsing/planning.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rick Schumeyer 2005-02-02 16:07:57 basic pg lock question
Previous Message Thomas F.O'Connell 2005-02-02 15:54:35 Re: PL/PgSQL, Inheritance, Locks, and Deadlocks