Article View: borland.public.cppbuilder.database.ado
Article #1245Re: Adoquery slow record retreval
From: Viatcheslav V. Vassiliev
Date: Sat, 04 Sep 2004 07:14
Date: Sat, 04 Sep 2004 07:14
61 lines
3256 bytes
3256 bytes
1. Use server-side cursor (CursorLocation = crUseServer).
2. Do not use FindFirst(), use First().
3. Do not use RecordCount - use:
while (!ADOQuery1->Eof)
{
...
ADOQuery1->Next();
}
4. Call DisableControls()/EnableControls() even if there are no controls
attached.
BTW, with OLEDB Direct you will be able to fetch records directly into
CustLocaTableRec record, without convertion of db value into Variant and
back to record field type.
//------------------------------------------
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:4138c989$1@newsgroups.borland.com...
> Hi
>
> I am using a TADOQuery component to access a local MS Access database
> table on my machine. The problem is the time it takes to read all the
> records in the table is unacceptably slow. I have about 160,000 records in
> the table and I read in each records information. If I comment out all the
> code in my loop and only leave the statement ADOQuery1->Next(), this is
the
> bottle neck it takes about five minutes to retrieve all the records. I
tried
> setting the CacheSize property to 10,000 but it didn't speed up the
> application. How can I optimize accessing the data, to make it expectable.
> My code is below.
>
> // Go to the first record
> ADOQuery1->FindFirst();
> for(i1=0;i1<ADOQuery1->RecordCount;++i1) {
> // Catch conversion errors
> try {
> CustLocTableRec.X = ADOQuery1->FieldValues["X"];
> CustLocTableRec.Y = ADOQuery1->FieldValues["Y"];
> CustLocTableRec.NodeID = ADOQuery1->FieldValues["NodeID"];
> CustLocTableRec.LegID = ADOQuery1->FieldValues["LegID"];
> } catch(...) {
> LOGWARNINGS = true;
> break;
> }
> CustLocTableRec.Used = false;
> CustLocTable[ADOQuery1->FieldValues["ServiceID"]] =
> CustLocTableRec;
> ADOQuery1->Next(); // Bottle neck
> }
>
>
Technical Details
Message-ID:
<41396b4f@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4138c989$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,7660a242b4ab7f8a X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <4138c989$1@newsgroups.borland.com> Subject: Re: Adoquery slow record retreval Date: Sat, 4 Sep 2004 11:14:03 +0400 Lines: 63 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: <41396b4f@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1094282063 213.234.218.42 (4 Sep 2004 00:14:23 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail