Suggestions for the best strategy to emulate returning multiple sets of results

From: Seref Arikan <serefarikan(at)kurumsalteknoloji(dot)com>
To: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Suggestions for the best strategy to emulate returning multiple sets of results
Date: 2012-10-08 20:14:58
Message-ID: CA+4ThdozNHwcjyJTC4ehQqZ+GVU4FdOSyj2d63WSdLtpu6OzeQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greetings,
I have a binary blog which is passed to a plpython function by a plpgsql
function. plpython is used to create 2 different transformations of this
binary blob to sets of postgresql type instances.
The flow is: blob -> plpython -> canonical python based data model ->
(set of db_type_As + set of db_type_Bs)
The problem is, transforming the binary blob to postgresql is expensive,
and a single binary blob is the source of two transformations. I have not
found a way of returning to sets of data form the plpython function.
At the moment, I have two options:
1) calling two functions in plpython that use the same blob and return
different sets of postgresql types (heavyweight transformation will happen
twice: bad)
2) creating two temp tables and calling the plpython function which in turn
writes to these temp tables, and then using the temp tables from plpgsql.

Do you think there are any other options that I might be missing? What
would be the most efficient way of passing temp tables to plpython function?

Kind regards
Seref

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Serodio (lists) 2012-10-08 20:39:44 Help estimating database and WAL size
Previous Message Scott Marlowe 2012-10-08 15:22:20 Re: server process (PID 1304) was terminated by exception 0xC0000142