pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ceki Gulcu <cekgul@yahoo.com>
To: pgsql-jdbc@postgresql.org
Subject: getGeneratedKeys method
Date: Wed, 26 May 2004 04:56:32 -0700 (PDT)
Message-ID: <20040526115632.87009.qmail@web51008.mail.yahoo.com> (raw)

Hello,

We, the log4j developers, are working on an appender
that will write
log4j events to various RDBMS Various fields of an
event object will
go to 3 different tables, namely the logging_event
table, the
logging_event_property table and the
logging_event_exception
table. Each entry in the logging_event_property and
the
logging_event_exception tables uses a reference to
event_id, where
event_id is a database generated primary key in the
logging_event
table.

For entries in the logging_event_property and
logging_event_exception
tables to be meaningful, we absolutely need the
generated event_id
each time we insert a new logging_event row. We are
able to do this by
following each logging_event insertion with a query to
the database
asking for the event_id of the last inserted event.
This works for
multiple database systems.

However, we have discovered that batching multiple
insertions gives a
very significant boost in performance. Thus, we would
like to insert
say 50 logging_event rows, then multiple
logging_event_property rows
and then multiple logging_event_exception rows. We are
using the
JDBC getGeneratedKeys method to obtain the event_ids.
Unfortunately, this
function is not implemented in Postgresql.


Looking at the archives it seems that this
functionality requires
support for the database back end which does not exist
currently. Is
that correct?

Is there another way to insert into multiple tables in
batches as
described above without using the JDBC
getGeneratedKeys  method?

Your views on the matter would be highly appreciated.
Thanking you
in advance,


-- 
Ceki Gülcü

     For log4j documentation consider "The complete
log4j manual" 
     ISBN: 2970036908
http://www.qos.ch/shop/products/clm_t.jsp 



	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 



view thread (9+ messages)  latest in thread

Message-ID: <20040526115632.87009.qmail@web51008.mail.yahoo.com>
Permalink:  ../20040526115632.87009.qmail@web51008.mail.yahoo.com/
Also on:    postgresql.org/message-id/20040526115632.87009.qmail@web51008.mail.yahoo.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: cekgul@yahoo.com
  Subject: Re: getGeneratedKeys method
  In-Reply-To: <20040526115632.87009.qmail@web51008.mail.yahoo.com>
  References: <20040526115632.87009.qmail@web51008.mail.yahoo.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