Re: Having a plpgsql function return multiple rows that indicate its progress in a cursor like fashion

From: Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com>
To: PGSQL Mailing List <pgsql-general(at)postgresql(dot)org>
Cc: Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>
Subject: Re: Having a plpgsql function return multiple rows that indicate its progress in a cursor like fashion
Date: 2010-02-16 09:34:18
Message-ID: db471ace1002160134r39b00b96jd9d4d89df6097a5e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> I'd think RETURN NEXT would behave the way you want it to. There's probably something in your function causing your function to behave like it does now. I suspect the problem lies in the way you determine how far you've progressed, but you didn't tell us anything about your function, so I'm just guessing.
>

Why do you think that? At the moment, the function merely sends two
messages along the lines of "beginning downloading...", "connecting
to first db...", before connecting to the first remote DB, which, in
my perfunctory testing was unavailable. The connection blocks, throws
an exception, is handled in an EXECPTION block (by once again sending
a message in the usual way). However, I get all 3 messages at once,
only when the dblink function finishes blocking and throws its
exception, which takes about 7 seconds because I like to use a timeout
in my connection string.

> I don't know much about dblink, so it is possible your problem is related to that. I imagine it may batch "small" result sets and send them over all at once to reduce traffic. Do you see this problem with larger result sets (say >10k rows)?
>

I'll attempt to devise a useful test, but I'm a little doubtful that
I'll get anywhere with my current approach, given that my initial,
very simple test failed.

Regards,
Peter Geoghegan

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2010-02-16 10:21:37 Re: Having a plpgsql function return multiple rows that indicate its progress in a cursor like fashion
Previous Message Pavel Stehule 2010-02-16 09:03:25 Re: Having a plpgsql function return multiple rows that indicate its progress in a cursor like fashion