Board index » delphi » Why is DBExpress so slow compared to ADO

Why is DBExpress so slow compared to ADO


2007-08-02 12:13:40 AM
delphi186
I have 1 master query and two detail queries. I have the master query iterate through 2000 records. Using ADO this takes 6 seconds. Using DBExpress it takes 60. Why is DBExpress performing so bad?
Using SQL Server Express 2005
 
 

Re:Why is DBExpress so slow compared to ADO

Preston writes:
Quote
I have 1 master query and two detail queries. I have the master query
iterate through 2000 records. Using ADO this takes 6 seconds. Using
DBExpress it takes 60. Why is DBExpress performing so bad?
It is impossible to answer your question without much more detailed
information.
What components are you using with ADO and dbExpress?
I assume you are using Delphi 2007 and DBX4 since you did not say
otherwise. Is that correct?
Are you using a client side cursor with ADO?
Are you using a ClientDataSet and DataSetProvider with DBX?
How many rows does the master query return?
How are you creating the master/detail link with ADO?
How are you creating the master detail link with DBX?
--
Bill Todd (TeamB)
 

Re:Why is DBExpress so slow compared to ADO

Hi Bill,
Answers are inline.
Quote
What components are you using with ADO and dbExpress?
TADOConneciton - TADOQuery, TSQLConneciton - TSQLQuery
Quote
I assume you are using Delphi 2007 and DBX4 since you did not say otherwise. Is that correct?
D2006 DBX3
Quote
Are you using a client side cursor with ADO?
I didn't see anything that would allow me to turn it off, so whatever the defaults are.
Quote
Are you using a ClientDataSet and DataSetProvider with DBX?
At this point, it is just queries.
Quote
How many rows does the master query return?
2000
Quote
How are you creating the master/detail link with ADO?
select * from table where field = :field
Quote
How are you creating the master detail link with DBX?
select * from table where field = :field
procedure TForm2.Button1Click(Sender: TObject);
var
x : integer;
begin
// ADOQuery1.Active := True;
// ADOQuery2.Active := True;
// ADOQuery3.Active := True;
SQLQuery1.Active := True;
SQLQuery2.Active := True;
// SQLQuery3.Active := True;
//SQLQuery4.Active := True;
//SQLQuery5.Active := True;
x := 0;
while not SQLQuery1.Eof do
begin
label1.Caption := intToStr(x);
inc(x);
SQLQuery1.Next;
Application.ProcessMessages;
end;
SQLQuery1.Active := False;
end;
 

Re:Why is DBExpress so slow compared to ADO

I don't know what the difference is. Since you do not access any value
in the record it is possible that ADO does not fetch the record from
the server and DBX does. I'd change the code to assign the value
from some field to a variable and see what happens. I'd also try
just the master query without the details and see what happens.
--
Bill Todd (TeamB)
 

Re:Why is DBExpress so slow compared to ADO

"Bill Todd" <XXXX@XXXXX.COM>writes:
Quote
I don't know what the difference is. Since you do not access any value
in the record it is possible that ADO does not fetch the record from
the server and DBX does. I'd change the code to assign the value
from some field to a variable and see what happens. I'd also try
just the master query without the details and see what happens.

--
Bill Todd (TeamB)
I have tried running with just the master queries and DBExpress improves quite a bit. I think the slowness has something to with how the relationship between the master and detail query is created. I say this because as I add more detail queries it gets slower exponentially. ADO doesn't have this problem.
I really don't know if ADO is retrieving the data. I can see that it IS executing the detail queries (using the profiler).
Is there a way to turn the client side caching off for ADO?
 

Re:Why is DBExpress so slow compared to ADO

Preston writes:
Quote
Is there a way to turn the client side caching off for ADO?
Set the CursorLocation property to clUseServer.
--
Bill Todd (TeamB)