Article View: borland.public.cppbuilder.database.ado
Article #200Re: Fastest Way to Insert a Number of Records via SQL
From: Dan
Date: Fri, 08 Jun 2007 20:53
Date: Fri, 08 Jun 2007 20:53
31 lines
1981 bytes
1981 bytes
I'm still not at copy and paste speeds but was able to decrease insert
times by over 80%.
I started with this:
TADOQuery *SQLObject = (pointer of actual object);
do
{
SQLObject->SQL->Text = "Insert into [tablename] (fields...) VALUES
(values..)";
}
while (still have to import huge number of records);
SQLObject->ExecSQL();
To increase I changed the above to something like this:
TADOQuery *SQLObject = (pointer of actual object);
SQLObject->SQL->Text = "Select (field) from [tablename] where (field
doesn't already exist); //fast query to turn on SQL
do
{
SQLObject->InsertRecords(ARRAYOFCONST((fieldvalues...)));
}
while (still have to import huge number of records);
SQLObject->BatchUpdate(arAll);
Any other suggestions on how to increase speed? I am presently at
around 200ms for 520 records, and I'd like to be well less than 100ms
Dan
Technical Details
Message-ID:
<4669c1e0$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<46645ac3@newsgroups.borland.com> <466477c6$1@newsgroups.borland.com> <466580d1@newsgroups.borland.com> <4665925c@newsgroups.borland.com> <46659f88@newsgroups.borland.com> <4666194d@newsgroups.borland.com> <46665d06@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,d0a6c05550b4cac9 X-Google-Attributes: gid10698b,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Date: Fri, 08 Jun 2007 15:53:48 -0500 From: Dan <Dan@do.not.spam> User-Agent: Thunderbird 1.5.0.12 (Windows/20070509) MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.database.ado Subject: Re: Fastest Way to Insert a Number of Records via SQL References: <46645ac3@newsgroups.borland.com> <466477c6$1@newsgroups.borland.com> <466580d1@newsgroups.borland.com> <4665925c@newsgroups.borland.com> <46659f88@newsgroups.borland.com> <4666194d@newsgroups.borland.com> <46665d06@newsgroups.borland.com> In-Reply-To: <46665d06@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 216.174.165.174 Message-ID: <4669c1e0$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1181336032 216.174.165.174 (8 Jun 2007 13:53:52 -0700) Lines: 31 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail