pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Quartz <quartz12h@yahoo.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: JDBC gripe list (the autocommit subthread)
Date: Wed, 30 Mar 2011 06:49:30 -0700 (PDT)
Message-ID: <343012.69342.qm@web33203.mail.mud.yahoo.com> (raw)

> Well in the postgresql world every statement is a transaction.

I agree with that. But a batch with autocommit=true is "many" statements, as per the doc.


> That being said  the concept of batch processing in postgres is that it
> would be done in a transaction otherwise what is the point ?


If addBatch was not meant to be called when autocommit=true, then it would have thrown an exception. The point is to enable multiple statement in 1 executeBatch call. Just imagine a system that separates who makes statements and who executes them. Like event logging lets say. Meanwhile, there are infinite cases where multiple statements are not (and must not) be in a all-or-nothing transaction. This is why applications choose to set autocommit=true to obtain the batch behavior without a TX. It's in the API for such reasons.

It is just incorrect to consider the batch is 1 transaction when the API clearly exposes the ability to avoid it. As I wrote earlier, calling applications that just pile up updates in a batch not expecting any deadlock due to row locking by each statement, will not work anymore.

The fact the API have autocommit independant from batches means it serve a purpose. I see it. But even if I didn't, the API says so and I can't second guess it.

I know it hurts to learn such truth after such a long delay. You'll get over it! lol! I have found a 4 year old bug lately, in my own code. I know the feeling. But I can't decide to call it a feature...lol



> If you agree with that then in the postgres world it would be natural
> for all of it to fail. At least thats how I would expect postgres to act.
> 
> Dave




view thread (21+ messages)  latest in thread

Message-ID: <343012.69342.qm@web33203.mail.mud.yahoo.com>
Permalink:  ../343012.69342.qm@web33203.mail.mud.yahoo.com/
Also on:    postgresql.org/message-id/343012.69342.qm@web33203.mail.mud.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: quartz12h@yahoo.com
  Subject: Re: JDBC gripe list (the autocommit subthread)
  In-Reply-To: <343012.69342.qm@web33203.mail.mud.yahoo.com>
  References: <343012.69342.qm@web33203.mail.mud.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