I tested the JDBC batch submit versus using looping over CFQuery and
the results were about the same: 9 seconds to insert 2000 rows into a
2-column table.  So, in my testing, it appears that the JDBC batch
submit is no faster.  I was surprised.

I was hoping it would be a lot faster to do the JDBC batch since the
following 'SQL Hack' that sends the data as one large insert takes less
than 1 second (thanks to someone on the CFCDev list for this
suggestion):

<cfquery datasource="Test" >
  INSERT INTO JONTEST  (ID, Age)
  <cfloop from="1" to="2000" index="i" >
    SELECT <cfqueryparam cfsqltype="cf_sql_char" value="#GUIDs[i]#" >,
<cfqueryparam cfsqltype="cf_sql_numeric" value="#i#" > FROM DUAL
    <cfif i NEQ 2000 >
      UNION ALL
    </cfif>
  </cfloop>
</cfquery>

Unfortunately, I know of no similar hack for doing random UPDATE's.

Jon

>>> [EMAIL PROTECTED] 5/19/2004 4:28:38 AM >>>
On Tuesday 18 May 2004 19:11 pm, Jon Gunnip wrote:
> PreparedStatement stmt = conn.prepareStatement( "INSERT INTO Users
> VALUES(?,?)");
> User[ ] users = ...;
> for(int i=0; i<users.length; i++) {
>     stmt.setInt(1, users[i].getName());
>     stmt.setInt(2, users[i].getAge());
>     stmt.addBatch( );
> }

>>I don't see that being better than a cfloop'ed cfqueryparam'ed
cfquery inside
>>a cftransaction block.
>>We don't see any scale issues with Oracle here - what have you seen
?
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to