Re: Detection of nested function calls - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Detection of nested function calls
Date
Msg-id CA+Tgmob5SkFDj_HL76fPUVwVu_hZz4i5v2eP=4j4QzJsdu=n1A@mail.gmail.com
Whole thread Raw
In response to Re: Detection of nested function calls  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Fri, Oct 25, 2013 at 10:18 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Hugo Mercier <hugo.mercier@oslandia.com> writes:
>> PostGIS functions that manipulate geometries have to unserialize their
>> input geometries from the 'flat' varlena representation to their own,
>> and serialize the processed geometries back when returning.
>> But in such nested call queries, this serialization-unserialization
>> process is just an overhead.
>
> This is a reasonable thing to worry about, not just for PostGIS types but
> for many container types such as arrays --- it'd be nice to be able to
> work with an in-memory representation that wasn't just a contiguous blob
> of data.  For instance, assignment to an array element might become a
> constant-time operation even when working with variable-length datatypes.

I bet numeric could benefit as well.  Essentially all of the
operations on numeric start by transforming the on-disk representation
into an internal form used only for the duration of a single call, and
end by transforming the internal form of the result back to the
on-disk representation.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: fabriziomello
Date:
Subject: Re: psql should show disabled internal triggers
Next
From: Emanuel Calvo
Date:
Subject: Additional information on log_line_prefix