It sounds pretty good. But I don't understand it exactly. Could you write
down the sample codes?

Matthew L. Creech wrote:
> On Mon, Apr 27, 2009 at 10:25 PM, liubin liu <> wrote:
>> thanks
>> I'm not sure of the real reason.
>> It's true that the speed of inserting with transaction is very fast. But
>> my
>> project is using SQLite mainly in selecting something. I don't know how
>> to
>> use transaction in the situation. May some friends give me some codes on
>> that?
> As someone else mentioned, you probably don't want to open/close the
> database every time you do a single SELECT.  In the example you're
> doing 100,000 iterations of open/exec/close, which will give pretty
> terrible performance.
> Instead, try creating an initialization call, which opens the
> database, prepare()s your SELECT stmt (with a '?' placeholder for the
> ID in this example), and returns a handle to the caller.  The caller
> can then loop 100,000 times calling getdata() with this handle.
> getdata() can just do sqlite3_bind_XXX() followed by sqlite3_step()
> (and sqlite3_reset()), which will be _much_ faster than
> sqlite3_exec().
> -- 
> Matthew L. Creech
> _______________________________________________
> sqlite-users mailing list

View this message in context:
Sent from the SQLite mailing list archive at

sqlite-users mailing list

Reply via email to