Re: JDBC behaviour

From: Vitalii Tymchyshyn <vit(at)tym(dot)im>
To: Bill Moran <wmoran(at)potentialtech(dot)com>
Cc: Craig Ringer <craig(at)2ndquadrant(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, John R Pierce <pierce(at)hogranch(dot)com>, "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC behaviour
Date: 2016-02-20 16:29:09
Message-ID: CABWW-d3dDrDQbKA1uh5o3XzFcLrzc7QtHkRsxSdrznUUD=Vq6Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-jdbc

Well, I suppose replacing simple copy with procedural per-row function
would give huge performance hit. Also what method do you propose to use in
the code? Savepoints? I'd say this would also add a more slowdown.
Also quite a bit of boilerplate code would be needed. It's similar to merge
statement. Yes, it can be achieved in pure SQL, but having clean merge
statement saves you a lot of headache and is usually much more efficient.
Basically, it's not that what OP needs is not doable at all, it's that
other RDBMs often has this functionality in much more convenient and
performance optimized way.

Best regards, Vitalii Tymchyshyn

Сб, 20 лют. 2016 11:16 Bill Moran <wmoran(at)potentialtech(dot)com> пише:

> On Sat, 20 Feb 2016 16:01:04 +0000
> Vitalii Tymchyshyn <vit(at)tym(dot)im> wrote:
>
> > Well, it OT here and belongs to -hackers, but as for me main use case
> here
> > is ETL or ELT process getting a lot of unvalidated external data.
> > And a good option to solve this problem is not to change transaction
> > semantics or slow down processing by adding tons of savepoints, but add
> "on
> > error" clause to insert/copy statement.
> >
> > This clause should allow to save records that can't fit into destination
> > table because of type, check of referential constaints into error table.
> > Oracle has similar functionality and we are using it in our project. No
> > error is generated - no transaction rollback, batch abort or similar.
> >
> > As for me it would cover 90% of use cases and would be really usefull.
> The
> > one problem I can see is with inserting into partition parent.
>
> PL/PGSQL provides this functionality. It requires the creation of a server
> side function and using that function to insert data, but it can do exactly
> what you're describing.
>
> While adding other mechanisms to make it "easier" or "more like some other
> software" might be valuable; the simple fact is that Postgres _does_
> support
> what you want. The fact that you're not aware of it doesn't change that.
>
> --
> Bill Moran
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message tuanhoanganh 2016-02-20 16:46:38 Why Postgres use a little memory on Windows.
Previous Message Bill Moran 2016-02-20 16:16:25 Re: JDBC behaviour

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2016-02-20 16:35:35 Tutorial document
Previous Message Bill Moran 2016-02-20 16:16:25 Re: JDBC behaviour

Browse pgsql-jdbc by date

  From Date Subject
Next Message Bill Moran 2016-02-20 17:09:01 Re: JDBC behaviour
Previous Message Bill Moran 2016-02-20 16:16:25 Re: JDBC behaviour