🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Access 2000 DB Question

#1022
From: J Borchers
Date: Sun, 12 Dec 2004 17:24
49 lines
2581 bytes
Hi all,

I have an access 2000 DB. I get horrid performance doing INSERT statements. 
I use the ADOQuery component. I have a table created as such:

 Query1->SQL->Add("CREATE TABLE Articles");
 Query1->SQL->Add("(ArticlesID COUNTER,");
 Query1->SQL->Add("ServerID LONG, GroupsID LONG,");
 Query1->SQL->Add("Subject CHAR (100) NOT NULL,");
 Query1->SQL->Add("ArticleNumber LONG,");
 Query1->SQL->Add("Checksum LONG,");
 Query1->SQL->Add("PRIMARY KEY (ArticlesID))");
 TrySQL();

At first I would add records using the SQL Insert statement adding one 
record at a time. This took about 50mS per record - way too slow for a 
1.8GHz machine with 650 MB ram.

Then, I changed the source to do this:

ArticlesQuery->Insert();
ArticlesQuery->FieldValues["ServerID"]=
                       ServersQuery->FieldValues["ServerID"];
ArticlesQuery->FieldValues["GroupsID"]=
                        GroupListQuery->FieldValues["GroupsID"];
ArticlesQuery->FieldValues["Subject"]=Subject;
ArticlesQuery->FieldValues["ArticleNumber"]=ArticleNumber;
int chk=Recovery1->Checksum(Subject);
ArticlesQuery->FieldValues["Checksum"]=chk;
ArticlesQuery->Post();

Then every 5000 records I do:

ArticlesQuery->UpdateBatch(arAll);

where ArticlesQuery is:

LockType=batchOptimistic;

It seems to take the same amount of time total to do either?

What is the best way (or proper way) to add a list of records at one time? 
What is the best local database to use for this. I would expect performance 
that is somewhere close to adding structures to a file not the horrid 
performance I am getting.

Any help appreciated TIA,

John Borchers
Technical Details
Message-ID: <41bc7ed6$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!newsfeed.icl.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,52c9d377ef0d87a7,start
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "J Borchers" <jborchers@noemailtome.com>
From: "J Borchers" <jborchers@noemailtome.com>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Access 2000 DB Question
Date: Sun, 12 Dec 2004 12:24:40 -0500
Lines: 56
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 65.78.105.117
Message-ID: <41bc7ed6$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1102872278 65.78.105.117 (12 Dec 2004 09:24:38 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!newsfeed.icl.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail