🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #3862

Re: It is too many slow...

#3862
From: M. Noroozi Eghbali
Date: Sun, 09 Jun 2002 04:01
144 lines
6100 bytes
Hi,

Thanks for your notice, Jurko. Your suggestion couldn't solve my problem.
The Application is not Client/Server. I know my computer has enough speed.
(P4 1.8GHz + 512MB RD-Ram(400 MHz Bus) and enough free space on a 7200 rpm
HDD). The exact point of the problem is "DataModule1->ADOTable1->Post();".
This command is working too slow even if only one of the fields of the table
changed. Any other idea?

Regards,
Mehrdad




"Jurko" <Jurko@ve-mil.hr> wrote in message
news:cq9tda.sv8.ln@news.ve-mil.hr...
> One suggestion... get the TField pointers out first using FieldByName and
> then
> use those TField pointers to set the data and not FieldByName every
time...
> that
> will most defenetively speed up your program...
>
> like this:
>
>
> TADOTable* const table( DataModule1->ADOTable1 );
> TField* const fld_level( table->FieldByName("Level") );
> TField* const fld_term( table->FieldByName("Term") );
> TField* const fld_bt( table->FieldByName("BT") );
> ...
> {
>     table->Append();
>     fld_level->AsInteger = ...;
>     fld_term->AsString = ...;
>     fld_bt->AsString = ...;
>     ...
> }
>
> (This is a wild guess as I don't know the exact way you're connecting
> to your database:) I would suggest against using server side cursors...
> or directly changing the data in the database with each line. Use server
> side cursors if the amount of data is too big for your client, but in that
> case use batch updates.
>
> HTH,
>     Jurko
>
> "M. Noroozi Eghbali" <galaxy@irandoc.ac.ir> wrote in message
> news:3d021be7_2@dnews...
> > Hi,
> >
> > I am using an ADOTable and a DataSource (Microsoft.Jet.OLEDB.4.0) to
save
> my
> > database in an Access file. It has about 25 fields and none of them are
> > indexed. The number of records is about 60000. When I start the saving
to
> > the Access file, in the first second about 100 records were saved. The
> > saving speed gradually decreases inasmuch as after 15000 records the
> saving
> > speed reaches to maximum 1 record per second. I wrote the code of the
> saving
> > function here. please tell me what is the wrong.
> >
> > Regards,
> > Mehrdad
> >
> > void __fastcall TForm1::Save(TTreeNode *Node)
> > {
> >  typedef CNodeData* PNodeData;
> >      TTreeNode *ChildNode;
> >
> >  do
> >      {
> >       DataModule1->ADOTable1->Append();
> >           DataModule1->ADOTable1->FieldByName("Level")->AsInteger =
> > Node->Level;
> >           DataModule1->ADOTable1->FieldByName("Term")->AsString =
> > Node->Text;
> >           DataModule1->ADOTable1->FieldByName("BT")->AsString =
> > PNodeData(Node->Data)->BT;
> >           DataModule1->ADOTable1->FieldByName("NT")->AsString =
> > PNodeData(Node->Data)->NT;
> >           DataModule1->ADOTable1->FieldByName("RT")->AsString =
> > PNodeData(Node->Data)->RT;
> >           DataModule1->ADOTable1->FieldByName("SN")->AsString =
> > PNodeData(Node->Data)->SN;
> >           DataModule1->ADOTable1->FieldByName("UF")->AsString =
> > PNodeData(Node->Data)->UF;
> >           DataModule1->ADOTable1->FieldByName("Translate1")->AsString =
> > PNodeData(Node->Data)->Translate1;
> >           DataModule1->ADOTable1->FieldByName("Translate2")->AsString =
> > PNodeData(Node->Data)->Translate2;
> >           DataModule1->ADOTable1->FieldByName("Translate3")->AsString =
> > PNodeData(Node->Data)->Translate3;
> >           DataModule1->ADOTable1->FieldByName("Hide")->AsBoolean =
> > PNodeData(Node->Data)->Hide;
> >           DataModule1->ADOTable1->FieldByName("Status")->AsInteger =
> > PNodeData(Node->Data)->Status;
> >           DataModule1->ADOTable1->FieldByName("InputDate")->AsString =
> > PNodeData(Node->Data)->InputDate;
> >           DataModule1->ADOTable1->FieldByName("ApprovalDate")->AsString
=
> > PNodeData(Node->Data)->ApprovalDate;
> >           DataModule1->ADOTable1->FieldByName("LastUpdate")->AsString =
> > PNodeData(Node->Data)->LastUpdate;
> >           DataModule1->ADOTable1->FieldByName("NotValidDate")->AsString
=
> > PNodeData(Node->Data)->NotValidDate;
> >           DataModule1->ADOTable1->FieldByName("ABB")->AsString =
> > PNodeData(Node->Data)->ABB;
> >           DataModule1->ADOTable1->FieldByName("SC")->AsString =
> > PNodeData(Node->Data)->SC;
> >   DataModule1->ADOTable1->FieldByName("HN")->AsString =
> > PNodeData(Node->Data)->HN;
> >   DataModule1->ADOTable1->FieldByName("SF")->AsString =
> > PNodeData(Node->Data)->SF;
> >   DataModule1->ADOTable1->FieldByName("CA")->AsString =
> > PNodeData(Node->Data)->CA;
> >   DataModule1->ADOTable1->FieldByName("EC")->AsString =
> > PNodeData(Node->Data)->EC;
> >   if(PNodeData(Node->Data)->Frequency.IsEmpty())
> >            DataModule1->ADOTable1->FieldByName("Frequency")->AsInteger =
> 0;
> >           else
> >            DataModule1->ADOTable1->FieldByName("Frequency")->AsInteger =
> > StrToInt(PNodeData(Node->Data)->Frequency);
> >           DataModule1->ADOTable1->FieldByName("Description")->AsString =
> > PNodeData(Node->Data)->Description;
> >
> >           DataModule1->ADOTable1->Post();
> >
> > ...
> > //Some codes to obtain next record from memory.
> > ...
> >
> >      }while(Node);
> > }
> >
> >
>
>
Technical Details
Message-ID: <3d02d2c9_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews
References: <3d021be7_2@dnews> <cq9tda.sv8.ln@news.ve-mil.hr>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,856e9c01d3c42b29
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-06-08 21:00:57 PST
From: "M. Noroozi Eghbali" <galaxy@irandoc.ac.ir>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3d021be7_2@dnews> <cq9tda.sv8.ln@news.ve-mil.hr>
Subject: Re: It is too many slow...
Date: Sun, 9 Jun 2002 08:31:05 +0430
Lines: 146
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 213.176.21.5
Message-ID: <3d02d2c9_1@dnews>
X-Trace: dnews 1023595209 213.176.21.5 (8 Jun 2002 21:00:09 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews