You are not logged in.
Pages: 1
I wish to report a dramatic increase in performance inserting records into Sqlite3 tables.
I have 81 tables with more than 200 million records that I was attempting to insert.
I attempted to insert 263000 records last night for 9 hours and the process was less than half done.
I was using Conn.Synchronous:=smFull and I was not using transactions.
Additionally, I was suffering a significant memory leak from Query: TSQLDBStatement.
Changing Conn.Synchronous:=smFull to Conn.Synchronous:=smOff and using conn.StartTransaction; and Conn.Commit; every 10000 records dramatically improved performance.
However, the memory leak continued until the application crashed.
The source of the memory leak was the Query: TSQLDBStatement.
I modified my code so that every use of Query looked like this:
Query := Conn.NewStatement;
Try
Query.Execute(sgSQL, False);
Finally
FreeAndNil(Query);
End;
The memory leaks completely disappeared.
The net result was the new code was 2001 times faster and there were no memory leaks.
Dick Maley
Having analyzed the tab delimited data and created an appropriate Sqlite3 table what is the fastest way of populating the table?
I have been looping through the creation of insert statements, however it is slow.
What is the fastest.
Thank you.
Richard Maley
Modifying my original code as follows does create the empty table.
procedure TForm3.FormCreate(Sender: TObject);
Var
aServerName: RawUTF8;
aDatabaseName: RawUTF8;
aUserID: RawUTF8;
aPassWord: RawUTF8;
Conn: TSQLDBSQLite3Connection;
begin
aServerName:=DirDB+'Sqlite3201211051120.db3';
ShowMessage(aServerName);
aDatabaseName:='';
aUserID:='';
aPassWord:='';
DB:=TSQLDBSQLite3ConnectionProperties.Create(aServerName,aDatabaseName,aUserID,aPassWord);
DB.UseMormotCollations := False;
Conn := DB.MainConnection as TSQLDBSQLite3Connection;
Conn.Connect;
end;
Thank you for your reply.
Richard Maley
I am trying to create an empty Sqlite3 database by using TSQLDBSQLite3ConnectionProperties. Not errors are thrown and no database is created.
How should I do this?
procedure TForm3.FormCreate(Sender: TObject);
Var
aServerName: RawUTF8;
aDatabaseName: RawUTF8;
aUserID: RawUTF8;
aPassWord: RawUTF8;
begin
aServerName:=DirDB+'Sqlite3201211051120.db3';
aDatabaseName:='';
aUserID:='';
aPassWord:='';
DB:=TSQLDBSQLite3ConnectionProperties.Create(aServerName,aDatabaseName,aUserID,aPassWord);
end;
Thank you.
Richard Maley
Pages: 1