pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rajesh Kumar Mallah <mallah.rajesh@gmail.com>
To: Jens Schipkowski <jens.schipkowski@apus.co.at>
Cc: pgsql-performance@postgresql.org
Subject: Re: really quick multiple inserts can use COPY?
Date: Mon, 11 Dec 2006 22:31:08 +0530
Message-ID: <a97c77030612110901j3e826675o56e23dfd175ddce4@mail.gmail.com> (raw)
In-Reply-To: <op.tkekypo381rjf6@xjens.apus.local>
References: <op.tkekypo381rjf6@xjens.apus.local>

> 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
>



view thread (8+ messages)  latest in thread

Message-ID: <a97c77030612110901j3e826675o56e23dfd175ddce4@mail.gmail.com>
Permalink:  ../a97c77030612110901j3e826675o56e23dfd175ddce4@mail.gmail.com/
Also on:    postgresql.org/message-id/a97c77030612110901j3e826675o56e23dfd175ddce4@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: mallah.rajesh@gmail.com, jens.schipkowski@apus.co.at
  Subject: Re: really quick multiple inserts can use COPY?
  In-Reply-To: <a97c77030612110901j3e826675o56e23dfd175ddce4@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox