Re: dblink() cursor error/issue (TopMemoryContext)

From: "Henry" <henry(at)zen(dot)co(dot)za>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: dblink() cursor error/issue (TopMemoryContext)
Date: 2008-06-02 17:05:10
Message-ID: 264f30190e8e59732ef0d1d2124e0d4a.squirrel@zenmail.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, June 2, 2008 6:53 pm, Tom Lane wrote:
> "Henry" <henry(at)zen(dot)co(dot)za> writes:
>> I'm trying to code a function to copy rows from one machine to another
>> using dblink and cursors:
>
> What PG version is this, exactly?

Arg, dammit. Sorry, it's version 8.2.6 (where the function is running),
talking to a remote machine running 8.3.1.

> I don't think your problem has anything to do with dblink per se.
> The repeated begin/exception blocks are apparently managing to leak
> some memory per iteration. I can't tell whether this represents
> a known (and perhaps already fixed) bug; it very likely depends on
> details you haven't shown us. Do you want to try to put together a
> self-contained test case? (Again, you likely don't need dblink to
> exhibit the issue.)

OK, will give this a swing; but I'll first upgrade to 8.3.1 and see what
that does.

> If you just want something that works now, try probing for an existing
> entry before inserting, instead of relying on catching an exception.

ok, but that's going to be slow considering I'm inserting almost a hundred
million rows.

My previous post wasn't entirely accurate: the dblink_exec() call in a
loop is also enclosed in a begin/exception/end block, yet it doesn't fail.
The only difference besides the dblink_exec call itself, is that I'm
using 'others' to catch any error from dblink_exec (using 'others' on the
first insert results in the same issue).

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Geoghegan 2008-06-02 18:26:49 Maintaining an index on a large table: Is there any potential for it to stall my application?
Previous Message Tom Lane 2008-06-02 16:53:31 Re: dblink() cursor error/issue (TopMemoryContext)