Article View: borland.public.cppbuilder.database.ado
Article #2531Re: Performance damn LOW!!! Please fix my codes
From: Viatcheslav V. Vassiliev
Date: Mon, 19 May 2003 14:00
Date: Mon, 19 May 2003 14:00
66 lines
3340 bytes
3340 bytes
You should optimize 2 things:
1. Your cycle:
TStrings has OnChange event and ADOQuery->SQL handles it. When you do
query->SQL->Add("something") TADOQuery sends this command to provider (it
gets Text, sets internal ADOCommand->CommandText etc.). So you should create
temporary TStringList, fill it with your cycle and then do
query->SQL->Assign(StringList).
2. ExecSQL itself.
You create script and send it to OLEDB provider. It is not the best way to
perform multiple insert operations. You should use TADOCommand, set command
text with parameters, prepare it and inside cycle set parameters and
execute.
Bulk inserts could be done from application. For this you should use OLEDB
interfaces. OLEDB Direct (http://www.oledbdirect.com) let you use them -
look $(OLEDBDirect)\SQL Server\1 000 000 rows demo.
----------------------------------------------------------------
Regards,
Viatcheslav V. Vassiliev
http://www.oledbdirect.com
The fastest way to access MS SQL Server, MS Jet (MS Access)
and Interbase (through OLEDB) databases.
"booker" <diablohsh@163.net> �������/�������� � �������� ���������:
news:3ec8a054$1@newsgroups.borland.com...
> My codes:
>
> for(;node;node=node->mNext)
> {
> cmdstr.printf("insert int tbl_some values(some1,some2....somen)");
> adoquery->SQL->Add(cmdstr);
> }
> adoquery->ExecSQL();
>
> the loop may execute for more than 10000 times....runing in a PIII850
> use 32 seconds(not including the ExecSQL). The speed is
inacceptable......i
> did some test and found that the slowest part is:
>
> query->SQL->Add(cmdstr);
>
> if i remove this line,the code only execute for 1500 ms ,i think it
must
> be the AnsiString allocation in the Add methord slow it down.
>
> I know that Bulk Insert may greatlly inprove the performance ,but i
> can't use it. because in my case,the appserver and sqlserver are in
> different computer,so the bulk insert must be able to locate the file in
the
> appserver via UNC file path.This require the sqlserver to run in a Windows
> Domain Acount,but i don't know how to setup a Windows Domain at all.
>
> So can any body point me out a way to boost the performance?
>
>
> Best regards,
> Bob H
>
>
Technical Details
Message-ID:
<3ec8e3b7@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!38.144.126.76.MISMATCH!feed2.newsreader.com!newsreader.com!news-out.visi.com!petbe.visi.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3ec8a054$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10698b,447c08d7d7d81fe X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2003-05-19 07:06:33 PST From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <3ec8a054$1@newsgroups.borland.com> Subject: Re: Performance damn LOW!!! Please fix my codes Date: Mon, 19 May 2003 18:00:22 +0400 Lines: 68 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 213.247.201.57 Message-ID: <3ec8e3b7@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1053352887 213.247.201.57 (19 May 2003 07:01:27 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!38.144.126.76.MISMATCH!feed2.newsreader.com!newsreader.com!news-out.visi.com!petbe.visi.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail