Unix Technical Forum

Re: really quick multiple inserts can use COPY?

This is a discussion on Re: really quick multiple inserts can use COPY? within the Pgsql Performance forums, part of the PostgreSQL category; --> > So, my questions: > Is it possible to use COPY FROM STDIN with JDBC? Should be. Its at ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Performance

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 09:53 AM
Rajesh Kumar Mallah
 
Posts: n/a
Default Re: really quick multiple inserts can use COPY?

> 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@postgresql.org so that your
> message can get through to the mailing list cleanly
>


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:20 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com