TIBCTable.Insert duration with lot of records
Posted: Tue 10 Jun 2008 12:14
Hello,
I need to insert a lot of records (30 000 rows) in a firebird database.
Here is my code for one record:
frmMain.TblEnreg.Insert;
frmMain.TblEnregNum.Value:=NbEnreg+1;
//Enregistre le nom et références du DAT
frmMain.TblEnregNom_Site.AsString:=frmMain.SiteLog;
frmMain.TblEnregRef_DAT.AsString:=frmMain.RefDATLog;
frmMain.TblEnregDate.Value:=date;
frmMain.TblEnregHeure.Value:=heure;
frmMain.TblEnregVe.Value:=StrToInt(ve);
frmMain.TblEnregVs.Value:=StrToInt(vs);
frmMain.TblEnregPhase.Value:=StrToInt(phase);
frmMain.TblEnregK.Value:=StrToInt(Rapp);
frmMain.TblEnregTyp.AsString:=Typ;
Inc(NbEnreg);
Here is sql given by dbmonitor (for one record) :
INSERT INTO ENREGISTREMENTS
(NUM, REF_DAT, NOM_SITE, DATE_ENREG, HEURE, VE, VS, K, PHASE, TYP)
VALUES
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
CommitRetaining;
My problem is that this is very very long. If i do it with a bde database (with the same code) it takes less than half time.
How could i optimise it?
Thank you very much
Regards
I need to insert a lot of records (30 000 rows) in a firebird database.
Here is my code for one record:
frmMain.TblEnreg.Insert;
frmMain.TblEnregNum.Value:=NbEnreg+1;
//Enregistre le nom et références du DAT
frmMain.TblEnregNom_Site.AsString:=frmMain.SiteLog;
frmMain.TblEnregRef_DAT.AsString:=frmMain.RefDATLog;
frmMain.TblEnregDate.Value:=date;
frmMain.TblEnregHeure.Value:=heure;
frmMain.TblEnregVe.Value:=StrToInt(ve);
frmMain.TblEnregVs.Value:=StrToInt(vs);
frmMain.TblEnregPhase.Value:=StrToInt(phase);
frmMain.TblEnregK.Value:=StrToInt(Rapp);
frmMain.TblEnregTyp.AsString:=Typ;
Inc(NbEnreg);
Here is sql given by dbmonitor (for one record) :
INSERT INTO ENREGISTREMENTS
(NUM, REF_DAT, NOM_SITE, DATE_ENREG, HEURE, VE, VS, K, PHASE, TYP)
VALUES
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
CommitRetaining;
My problem is that this is very very long. If i do it with a bde database (with the same code) it takes less than half time.
How could i optimise it?
Thank you very much
Regards