On Fri, Mar 03, 2006 at 04:00:58PM +0100, Daniel Franke wrote:
[...]
> > Finally, parsing a few million INSERT statements is very fast
> > in SQLite but it still takes time.  You can increase the speed
> > by a factor of 3 or more by using prepared statements, if you
> > are not already.
> As I understand it, sqlite_prepare() and friends will speed up
> statements that can be reused. After the initial parsing of the data
> file(s), all I got is a looong string of INSERT statements. Then, each
> statement is used exactly once.
[...]

The idea is to

        prepstm = prepare("insert into table values(?, ?)");

The "?" are vairables. You can assign to them and then run
the "compiled" (prepared) statement once for those values,
then set new values, run it again.
See sqlite3_bind_* and sqlite3_step for further details.

It might speed up your stuff a lot, as sqlite doesn't need
to parse the sql for each insert.


    Elrond

Reply via email to