[fdo-users] SQLite provider and transactions/batch inserts/

Igor Jarm igor at sl-king.com
Mon Apr 26 07:55:57 EDT 2010

Hello all!

I'm using SQLite FDO provider and need fast insert capabilities.

I had 4 options to test:
- individual inserts
(- transactions - not supported)
(- batch insert - not supported)
- compiled queries (*** see below)

I expected compiled queries would be comparable to SQLite transactions.
I'm, using code, that looks like this:

FdoPtr<FdoIInsert> ins =
    FdoPtr<FdoIFeatureReader> fr = ins->Execute();
    if(enoughExecutesToCommitToDatabase)  //100,1000,...
        ins = (FdoIInsert*)conn->CreateCommand(FdoCommandType_Insert);
//make a new one and release the old one

These are the results of timing 1000 inserts compared to unoptimized SQLite

- SQLite: 10.83s, 0.0108s per insert
- SQLite, transactions, 1000 per transaction: 0.19s, 0.0002s per insert
- FDO: 9.57s, 0.0096s per insert
- FDO: compiled queries, 1000 per commit, 9.49s, 0.0095s per insert
- FDO: compiled queries, 100 per commit, the same, etc. ...

Compiled queries are the same as executing individual inserts, .
Of course I could use SQLite directly but I have to keep everything in FDO.

Am I missing something?
Are there some plans to implement transactions or batch inserts for SQLite
FDO provider?
Or is there some other way to speed up the inserts?

Thank you.

Igor Jarm

//Insert is special. We attempt to speed up inserts if the caller is
//The contract is as follows -- as long as the caller reuses the SltInsert
//he is working with a compiled query and within a single transaction.
//the command object is freed, the transaction is committed.
class SltInsert : public SltCommand<FdoIInsert>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/fdo-users/attachments/20100426/9bebae0d/attachment.html

More information about the fdo-users mailing list