Thread: send()/receive() and on-disk storage

send()/receive() and on-disk storage

From
Markus Schaber
Date:
Hi,

Currently, there's a discussion on the pljava list, and we're confused
about a small detail:

Does PostgreSQL call the datatypes' defined send() function before
storing the tuple data in the table, on disk, and call receive() when
reading it again?

My position was that send()/receive() are only used for client
communication in the V3 protocol binary mode, and COPY in binary mode,
but the backend stores them in the tables as_is (modulo compression/
TOASTing).

Is my assumption correct?

Btw, I'm going to triple-check this in the source and via tests, too.

Thanks,
Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org


Re: send()/receive() and on-disk storage

From
Martijn van Oosterhout
Date:
On Fri, Sep 29, 2006 at 03:44:07PM +0200, Markus Schaber wrote:
> Does PostgreSQL call the datatypes' defined send() function before
> storing the tuple data in the table, on disk, and call receive() when
> reading it again?

No.

> My position was that send()/receive() are only used for client
> communication in the V3 protocol binary mode, and COPY in binary mode,
> but the backend stores them in the tables as_is (modulo compression/
> TOASTing).

Yes.

It would be terribly inefficient to call those functions for each
read/write. The disk has the internal format, send/receive deal with a
portable not-host-dependant representation of the data.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Re: send()/receive() and on-disk storage

From
Markus Schaber
Date:
Hi, Martijn,

Martijn van Oosterhout wrote:

> It would be terribly inefficient to call those functions for each
> read/write. The disk has the internal format, send/receive deal with a
> portable not-host-dependant representation of the data.

Thanks.

Markus

--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org