Re: [HACKERS] Faster methods for getting SPI results - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [HACKERS] Faster methods for getting SPI results
Date
Msg-id 98da4d04-796a-fad7-474d-79c7a9808d24@2ndquadrant.com
Whole thread Raw
In response to Re: [HACKERS] Faster methods for getting SPI results  (Jim Nasby <jim.nasby@openscg.com>)
List pgsql-hackers
On 3/5/17 16:07, Jim Nasby wrote:
>> There is nothing that requires us to materialize the results into an
>> actual list of actual rows.  We could wrap the SPI_tuptable into a
>> Python object and implement __getitem__ or __iter__ to emulate sequence
>> or mapping access.
> Would it be possible to have that just pull tuples directly from the 
> executor? The overhead of populating the tuplestore just to drain it 
> again can become quite significant, and AFAICT it's completely unnecessary.

I think there are many options, depending on what you want.  If you want
to materialize the result, then you have to materialize it somewhere,
and then make a Python object around that.  Or you could make an
iterator interface that just reads a tuple at a time.  Or maybe there
are other options.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Andreas Karlsson
Date:
Subject: Re: [HACKERS] rename pg_log directory?
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] rename pg_log directory?