--- jolz <[EMAIL PROTECTED]> wrote: > 1. Actually it isn't true for all databases that transaction will > speed up as much as SQLite does.
So are you suggesting to not use transactions? > 2. Batch isn't a good idea. At least not in SQLite driver - it will > simply store all queries in an ArrayList and execute just like you > would without a batch. If you have a lot of queries it may throw > OutOfMemory (but even if you won't use batch remember to call > setAutoCommit(false) and commit() when done). Batches are quite efficient. Just try to keep your batch sizes reasonable. With 50,000 to 100,000 rows per batch, memory will not be an issue. See section "6.1.2 PreparedStatements": http://java.sun.com/j2se/1.3/docs/guide/jdbc/spec2/jdbc2.1.frame6.html The SQLiteJDBC implementation reuses a single prepared statement just as a programmer might do manually. final synchronized int[] executeBatch(long stmt, int count, Object[] vals) throws SQLException { if (count < 1) throw new SQLException("count (" + count + ") < 1"); final int params = bind_parameter_count(stmt); int rc; int[] changes = new int[count]; for (int i=0; i < count; i++) { reset(stmt); for (int j=0; j < params; j++) if (sqlbind(stmt, j, vals[(i * params) + j]) != SQLITE_OK) throwex(); rc = step(stmt); // TODO: handle SQLITE_SCHEMA if (rc != SQLITE_DONE) { reset(stmt); if (rc == SQLITE_ROW) throw new BatchUpdateException( "batch entry "+i+": query returns results", changes); throwex(); } changes[i] = changes(); } reset(stmt); return changes; } ____________________________________________________________________________________ Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center. http://autos.yahoo.com/green_center/ --~--~---------~--~----~------------~-------~--~----~ Mailing List: http://groups.google.com/group/sqlitejdbc?hl=en To unsubscribe, send email to [EMAIL PROTECTED] -~----------~----~----~----~------~----~------~--~---
