You should use a transaction otherwise sqlite syncs the file for every INSERT.
Clive
"Alessandro Renzi (RM/TEI)" <[EMAIL PROTECTED]> on 31-01-2005
11:49:24
Please respond to [email protected]
To: "'[email protected]'" <[email protected]>
cc: (bcc: clive/Emultek)
Subject: [sqlite] slow "INSERT"
Hi,
I'm a new sqlite user.
For sure I'm doing something wrong with sqlite because it takes about 1 second
to perform 10 INSERT operation !
If instead I use the sqlite client and read an external file with thousands of
INSERT operation the updating is
almost immediate.
The test program I'm using is the following one:
char * sql = "INSERT INTO PEOPLE (NAME, AGE) VALUES ('John','25')";
for (int i=0; i<100; i++) {
rc = sqlite_exec(db,sql,callback,0,&zErrMsg);
if( rc!=SQLITE_OK ){
fprintf(stderr, "SQL error: %s\n", zErrMsg);
return 1;
}
}
Where I'm wrong ?
Thanks, Ale