Re: Faster methods for getting SPI results

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Jim Nasby <jim(dot)nasby(at)openscg(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Joe Conway <mail(at)joeconway(dot)com>
Subject: Re: Faster methods for getting SPI results
Date: 2017-03-06 20:13:08
Message-ID: 98da4d04-796a-fad7-474d-79c7a9808d24@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-03-06 20:16:49 Re: rename pg_log directory?
Previous Message Andreas Karlsson 2017-03-06 20:12:20 Re: rename pg_log directory?