Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Performance problem hard to solve

Re: Performance problem hard to solve

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Sat, 26 May 2007 11:19:16 +0100
Message-ID: <74SdnQpSyNY5lMXbRVnyvwA@bt.com>


"Hole" <h0leforfun_at_gmail.com> wrote in message news:1179760765.288270.64480_at_r3g2000prh.googlegroups.com...
> Hi all,
>
> first of all, thanks to anyone on this NG for your support and replies
> to my past and future posts.
>
> Now, the problem:
>
> I work with Oracle 10g XE, Java 1.4.2 on Win XP (but the problem is
> the same with a Unix machine and Oracle 10g).
>
> I need to perform some InsertOrUpdate statements and we thought to the
> following solution:
>
> try to insert, catch the SQL exception if the row already exists then
> perform the update statement.
>
> This solution presents excessive performance problem. Moreover, with
> the current application design and architecture, this solution seems
> the one applicable.
>
> With some profiling tools, we've noticed that the bottleneck is on DB.
> Java code takes the 10% of overall execution timing...It seems the 90%
> is for the violation on DB, when I try to insert a row that already
> exists, and the consequent SQLException.
>
> With a java profiler tool we can't monitor the DB performance.
>
> Anyone can suggest any (free or community edition) performance
> monitoring tools for Oracle 10g XE?
>
> And...anyone can suggest a better solution than "Try to insert, catch
> the exception if the row already exists then update"?
>
>
> Thanks in advance!
>
>

Performance depends on the probability
of getting duplicates and the number of indexes on the table. However, you may find that

    attempt to update
    if no row updated insert

is more efficient. The cost of a failed insert is quite high.

(That's assuming that you can't do the array-based merge suggested elsewhere).

-- 
Regards

Jonathan Lewis
http://jonathanlewis.wordpress.com

Author: Cost Based Oracle: Fundamentals
http://www.jlcomp.demon.co.uk/cbo_book/ind_book.html

The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html
Received on Sat May 26 2007 - 05:19:16 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US