Oyvind Idland wrote:
> Thanks for responses :)
> 
> Whereby "objects" you mean "rows," no? You are getting upward of 5500
>> sustained inserts per second. That sounds pretty good. That said, are
>> you using transactions? See what difference that makes.
>>
> 
> Yep, I meant rows. Inserting rows in the data table is much faster
> (1.000.000 in 20 secs or so).
> I am of course not expecting that inserts into a tree is as fast as a flat
> table, but a little
> boost wouldnt hurt. Its probably worth mentioning, that I am using a memory
> resident
> db, which I create at startup. The idea is to simply have a fast memory
> cache.
> 
> I am have tried to wrap it inside a transaction, my pattern is basically
> 
> sqlite3_exec(db, "BEGIN TRANSACTION;", 0, 0, 0);
> sqlite3_prepare_v2( <main table>);
> sqlite3_prepare_v2( <rtree>);
> for(.....)
> {
>   sqlite3_bind(<main table>);
>   sqlite3_step(<main table>);
>   sqlite3_reset(<main table>);
>   sqlite3_bind(<rtree>);
>   sqlite3_step(<rtree>);
>   sqlite3_reset(<rtree>);
> }
> sqlite3_finalize(<main table>);
> sqlite3_finalize(<rtree>);
> sqlite3_exec(db, "COMMIT TRANSACTION;", 0, 0, 0);
> 
> One thing I havent figured out, is, how is a transaction related to prepared
> statements ?
> I mean, using bind(), step() etc, there is a transaction handle, while
> BEGIN/END seems to be
> "global" ?  (thinking of threading etc)
> 
> I'll try to fiddle with Julian's idea.
> 

Transactions are global on a database connection. Once you issue a BEGIN 
TRANSACTION; on a database connection then all work on that same 
connection is part of that transaction untill you COMMIT or ROLLBACK the 
transaction.

-Steve
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to