Re: Faster methods for getting SPI results

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Joe Conway <mail(at)joeconway(dot)com>
Subject: Re: Faster methods for getting SPI results
Date: 2016-12-30 01:01:07
Message-ID: 93e424b7-7889-d5ce-38cc-e93cae29e301@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12/27/16 9:10 PM, Craig Ringer wrote:
> On 28 December 2016 at 09:58, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com> wrote:
>
>> I've looked at this some more, and ITSM that the only way to do this without
>> some major surgery is to create a new type of Destination specifically for
>> SPI that allows for the execution of an arbitrary C function for each tuple
>> to be sent.
>
> That sounds a lot more sensible than the prior proposals. Callback driven.

Here's what I've got right now. I haven't bothered with
SPI_execute_callback() yet, and there's some missing sanity checks.

I'm not sure if the changes to CreateDestReceiver() are warranted or
necessary, though it would at least give you sane defaults. My
incomplete code that would make use of this currently does

CallbackState callback;

memcpy(callback.pub, CreateDestReceiver(DestSPICallback),
sizeof(DestReceiver));
callback.pub.receiveSlot = PLy_CSreceive;
callback.pub.rStartup = PLy_CSStartup;
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-12-30 02:02:39 Re: gettimeofday is at the end of its usefulness?
Previous Message Peter Eisentraut 2016-12-29 22:18:08 Re: background sessions