Very slow performance??
Posted by: Vincent Chow
Date: October 25, 2004 11:16AM

Hi, I have this strange performance benchmark. I have a table with 4 columns which 1 of them is auto_incremented, while 2 of the remaining 3 columns are uniquely indexed.

There are about 2K records to insert. When I used prepared statement

connection.createPreparedStatement( "INSERT INTO xxxx VALUES ( null, ?, ?, ? )" );

It takes about 1 minute to insert all of them. But when I combine all the records using single-lined sql statement like this;

StringBuffer buffer = new StringBuffer();
for ( int i = 0; i < #of records; i++ )
buffer.append( x, x, x, x );
statement = connection.createStatement();
statement.executeUpdate( buffer.toString() );

It took less than 10ms to do the insertion.

Why was there such a huge performance difference? Was I doing something wrong?

Any help is greatly appreciated.

Options: ReplyQuote


Subject
Written By
Posted
Very slow performance??
October 25, 2004 11:16AM
November 01, 2004 11:40AM
November 02, 2004 10:32AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.