ADO / Clientdataset slowness
From: brag (ggroshner_at_fnis.com)
Date: 11/23/04
- Next message: Derrick: "Re: Trim char field on select - Solution"
- Previous message: Pepi Nillo: "FK Relation"
- Next in thread: Bill Todd: "Re: ADO / Clientdataset slowness"
- Reply: Bill Todd: "Re: ADO / Clientdataset slowness"
- Reply: Vitali Kalinin: "Re: ADO / Clientdataset slowness"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 23 Nov 2004 09:41:59 -0500
We've got an exisiting program originally devloped against BDE for which we
access all of our data through the ClientDataSet components. When we
converted to ADO, we hit some speed issues.
To test, I've created a simple demo form with a TADOQuery and
TADOConnection. I do a select * on a table out of a database (Oracle with
Oracle provider) that contains about 6,000 rows and loop through the result
set - important note - I'm using a server side cursor for speed. Here's the
code snippet:
idx := 0;
Memo1.Lines.Add(DateTimeToStr(Now));
ADOQuery1.Active := TRUE;
While not ADOQuery1.EOF do begin
inc(idx);
Memo1.Lines.Add(ADOQuery1.Fields.Fields[0].AsString);
ADOQuery1.Next;
end;
Memo1.Lines.Add('Total Records: ' + inttostr(idx));
Memo1.Lines.Add(DateTimeToStr(Now));
This code completes in 2 1/2 seconds, which is acceptable - the query itself
is actually way faster than that, but since I'm looping through the result
set and populating a memo it takes a total of 2 1/2 seconds to complete.
When I tie this together with a provider and a clientdataset, performance
goes south. The snippet is basically the same, but uses the clientdataset to
access the data:
idx := 0;
Memo1.Lines.Add(DateTimeToStr(Now));
ClientDataSet1.Active := TRUE;
While not ClientDataSet1.EOF do begin
inc(idx);
Memo1.Lines.Add(ClientDataSet1.Fields.Fields[0].AsString);
ClientDataSet1.Next;
end;
Memo1.Lines.Add('Total Records: ' + inttostr(idx));
Memo1.Lines.Add(DateTimeToStr(Now));
This code takes 19 seconds to complete. The delay all occurs when activating
the clientdataset. Since I think the query itself is taking less than 3
seconds, where does the other 16 seconds come from? Does anyone know of a
way to speed this up?
- Next message: Derrick: "Re: Trim char field on select - Solution"
- Previous message: Pepi Nillo: "FK Relation"
- Next in thread: Bill Todd: "Re: ADO / Clientdataset slowness"
- Reply: Bill Todd: "Re: ADO / Clientdataset slowness"
- Reply: Vitali Kalinin: "Re: ADO / Clientdataset slowness"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|