dblink bulk operations

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: dblink bulk operations
Date: 2009-08-06 15:11:58
Message-ID: 4A7AF2BE.2050205@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Last night I needed to move a bunch of data from an OLTP database to an
archive database, and used dblink with a bunch of insert statements.
Since I was moving about 4m records this was distressingly but not
surprisingly slow. It set me wondering why we don't build more support
for libpq operations into dblink, like transactions and prepared
queries, and maybe COPY too. It would be nice to be able to do something
like:

select dblink_connect('dbh','dbname=foo');
select dblink_begin('dbh');
select dblink_prepare('dbh','sth','insert into bar values ($1,$2,$3)');
select dblink_exec_prepared('dbh','sth',row(a,b,c)) from bar; -- can
we do this?
select dblink_commit('dbh');
select dblink_disconnect('dbh');

Does this seem worthwhile and doable, or am I smoking crack?

cheers

andrew

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2009-08-06 15:20:39 Re: GRANT ON ALL IN schema
Previous Message Peter Eisentraut 2009-08-06 15:04:19 Re: Re: [Pg-migrator-general] Composite types break pg_migrated tables