I don't have postgresql installed so I changed the connector to a TSQLConnector and tried it with my Firebird engine.
I needed to adjust the scriptbuild because Firebird couldn't handle multiple VALUES-records in one statement.
But... the TSQLScript also runs slower and slower with Firebird.
I changed the buttonclick so the TSQLScript is created fresh each time and then the interval seems stable.
So it's defenitly something in TSQLScript that's hanging in there after execution.
So this works better:
procedure TForm1.Button1Click(Sender: TObject);
var
curDate: TDateTime;
dateStr: string;
startTc: int64;
SQLScript2: TSQLScript;
begin
StartTest;
try
curDate := EncodeDate(2010, 1, 1);
while (curDate < EncodeDate(2010, 5, 1)) and run do
begin
SQLScript2 := TSQLScript.Create(nil);
try
SQLScript2.DataBase := SQLConnector1;
SQLScript2.Transaction := SQLTransaction1;
SQLScript2.AutoCommit := False;
BuildStatement(curDate, dateStr, SQLScript2.Script, startTc);
SQLScript2.Execute;
LogTime(curDate, dateStr, startTc);
finally
SQLScript2.Free;
end;
end;
finally
SQLConnector1.Close(True);
end;
end;
When I get some time I will investigate further.