#1 2011-08-23 08:54:20

jonsafi
Member
Registered: 2011-07-26
Posts: 58

Slow performance with multiple inserts

Hello,

Am getting a little bit the hang of this great framework
and was trying to add a couple of thousands of rows
to a simple stand alone application.

Seems though, that each row insertion is generating
a disk access and the whole process is quite slow,
at least 25 seconds/1000 rows.

The table has around 15 fields
and was using :

CourseId       := StringToUTF8(Courseid_);
StudentId      := StringToUTF8(StudentId_);
ID                  := globalClient.Add(myrec, true);

Also tried swithing to the synBigTable but with D2009,
compiling the following example code gives an error
for the AddField, saying:

E2010 Incompatible types: 'TSynTableFieldProperties' and 'Boolean'

Var FieldText : TSynTableFieldProperties;
TableBig:TSynBigTableRecord;
BEGIN
  TableBig  := TSynBigTableRecord.Create('DB.big','Mytable');
  FieldText := Table.AddField('text',tftWinAnsi,[tfoIndex]); // error!
   ...
END;

Any ideas? Your help is much appreciated,
thanks, Sami

Last edited by jonsafi (2011-08-23 09:12:48)

Offline

#2 2011-08-23 10:21:10

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,492
Website

Re: Slow performance with multiple inserts

That's why you'll have to use a TRANSACTION + [BATCH insert +] COMMIT

See http://blog.synopse.info/post/2011/06/0 … ng-records

And read the documentation about the transactions.

Offline

Board footer

Powered by FluxBB