🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Writing Multiple Records Slow

#1269
From: Viatcheslav V. Vassiliev
Date: Wed, 08 Sep 2004 08:12
48 lines
3149 bytes
Do you have strings in CustLoc? If yes, try to use ADO recordset directly,
without TADODataSet/TADOQuery/TADOTable. Try also execute all this code in
transaction - this may speedup your code ~2x, but requires enough RAM.
Instead of FieldValues["FieldName"] try to use Fields->Fields[X], where X is
integer. Calling DisableControls()/EnableControls() even if no controls
attached could help. If you create table before doing inserts, create
indeces after inserts.

In OLEDB Direct, you may look at example in "Examples\Tutorial\Step6 -
Transaction" - there is inserts 200 000 records (100 000 without transaction
and 100 000 with transaction). This takes 12 sec. on modern computer.

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"William" <wwestbrooks@houston.rr.com> �������/�������� � ��������
���������: news:413ded14$1@newsgroups.borland.com...
> Hi
>
>     I am using an TADOQuery component to open a table in an MS Access
> database and write about 150,000 new records to the table. The code I use
is
> below and it takes too long to write all the records to the database about
5
> minutes. The Append() and Post() functions seems to cause the bottle neck
> whenever that line of code is commented out . How can I fix my code so
that
> the records will be written to the database in an acceptable time limit.
>                 C1 = CustLoc.begin();
>                 while(C1! = CustLoc.end()) {
>                         ADOQuery2->Append();
>                         ADOQuery2->FieldValues["ServiceID"] = E1->first;
>                         ADOQuery2->FieldValues["X"] = C1->second.X;
>                         ADOQuery2->FieldValues["Y"] = C1->second.Y;
>                         ADOQuery2->FieldValues["NodeID"] =
> C1->second.NodeID;
>                         ADOQuery2->FieldValues["LegID"] =
C1->second.LegID;
>                         ADOQuery2->Post();
>                         ++C1;
>             }
>
>
Technical Details
Message-ID: <413ebeda$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!peer01.cox.net!cox.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <413ded14$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,12e770b67fbee4b4
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <413ded14$1@newsgroups.borland.com>
Subject: Re: Writing Multiple Records Slow
Date: Wed, 8 Sep 2004 12:12:11 +0400
Lines: 50
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 213.234.218.42
Message-ID: <413ebeda$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1094631130 213.234.218.42 (8 Sep 2004 01:12:10 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!peer01.cox.net!cox.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail