Re: really quick multiple inserts can use COPY?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So, my questions:
Is it possible to use COPY FROM STDIN with JDBC?

Should be. Its at least possible using DBI and DBD::Pg (perl)


my $copy_sth = $dbh -> prepare( "COPY
general.datamining_mailing_lists (query_id,email_key) FROM STDIN;") ;
 $copy_sth -> execute();
 while (my ($email_key ) = $fetch_sth -> fetchrow_array ()) {
         $dbh -> func("$query_id\t$email_key\n", 'putline');
 }
 $fetch_sth -> finish();
 $dbh -> func("\\.\n", 'putline');
 $dbh -> func('endcopy');
 $copy_sth->finish();

Some JDBC expert would tell better how its done with JDBC.


Will it bring performance improvement compared to SELECT UNION solution?

COPY is quite faast.

Regds
mallah.


many thanks in advance,
Jens Schipkowski

--
**
APUS Software GmbH

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
       message can get through to the mailing list cleanly



[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux