Board index » delphi » ClientDataSet & Network ver slow ?

ClientDataSet & Network ver slow ?


2005-01-08 03:29:42 AM
delphi89
I have a Delphi application with a paradox database en straithforward
database controls (mainly TTable, TDatasource and DBGrid). I tried to
include a TClientDataSet, connected to a TDataSetProvider which in turn is
connected to the old-and-reliable tables.
When using this combination in a stand-alone situation there are no real
problems. Reading a certain table completely with 13000 records takes with a
TTable about 1.5 seconds. Opening and filling the described TClientDataSet
with the same 13000 records takes about 2.5 seconds. This is no issue.
But when I use a network connection the reading times increases: for the
TTable it takes about 3 seconds to read all records. But for the
TClientDataSet it takes about 26 seconds to open and fill it with all 13000
records! Why does it take that long? Can I decrease the timing somehow?
Which point do I not get?
--
Best regards, Camiel Wijffels
 
 

Re:ClientDataSet & Network ver slow ?

When you open a TTable the BDE does not read all of the records in the
table. It only reads enough rows to populate the data aware controls the
TTable is connected to. When you open a CDS it does read all of the rows.
The problem is that the CDS was not designed to be used that way. The CDS
is intended for use with database servers in client/server applications.
In a client/server application you never allow a user to browse an entire
table. You use SQL SELECT statements to return a small set of rows for the
user to work with. When the user is done they enter new selection criteria
for the WHERE clause of the select and get the next set of records. Rarely
will a SELECT return over 100 records.
You can improve performance some by installing Manual Parma's memory
manager patch from Code Central but reading 13,000 rows across the network
will always take a lot of time.
--
Bill Todd (TeamB)
TeamB cannot answer questions received via email
 

Re:ClientDataSet & Network ver slow ?

"Bill Todd" <XXXX@XXXXX.COM>schreef in bericht
Quote
You can improve performance some by installing Manual Parma's memory
manager patch from Code Central but reading 13,000 rows across the network
will always take a lot of time.

--
Bill Todd (TeamB)
TeamB cannot answer questions received via email
Maybe I explained my test situation not well enough. Firstly lets look at my
local situation, so without the network. I take ONLY a TTable and set the
Tablename property to a paradox table which holds the 13000 records, and I
read ALL 13000 records in a dynamic array of records, which holds all the
fields. This takes about 1.5 second. I also take a TClientDataSet which I
connect to a TDataSetProvider, which in turn is connected to the
fore-mentioned TTable. I fill the TClientDataSet with ALL 13000 records,
using a value of the PacketRecords property of 1000 - this takes about 2.5
seconds.
Next I make a network connection and I put the paradox table on the network,
linking the database through the BDEAdmin to the network. When testing both
previous situation I count for the single TTable a performance of 3 seconds,
which is almost as good. For the TClientDataset is takes however 25 seconds
to fill it with all 13000 records.
I'll explain where my problem originates. The programmer who has worked on
this application before me, half a year ago, has only used TTables directly,
using several filters en lookup fields. When a user calculated a graph which
spans a whole year (which is approximatly between 1000 and 60.000 records)
all records have to be examined and added. As a consequence of this approach
this took from a few minutes to a few hours, especially when using a
network. I was able to bring this timing down to a few seconds thanks to the
approach of reading all records in an internal variable. But I have a few
problems with this approach, especially when using Master-Detail
relationships. Since the TClientDataSet is also an internal variable I
assumed this wouldnt take much longer to fill, and I was right - as far as
only a local database is used. But this week I have tested a network
situation (on my local machine, so this rules out any network problems) and
the result is very bad, as I mentioned.
I hope this clarifies my point. When my user selects a graph a new window
opens. After making a few selections he presses the Calculate button. This
starts up the calculation of the graph, which very often spans a whole year.
So it is very often needed to read in many records (for this example 13000).
When reading all the records of the table when the user presses Calculate
for the first time, it doesnt have to be read in the second time. And often
the user presses Calculate a few times with different selections. I can
choose to read in only the needed records, and especially with the
TClientDataSet this is a promising approach, but then it has to be as fast
as "normal", for when the user indeed needs all records.
Can you please help me speed up TClientDataSet?
--
Best regards, Camiel Wijffels
 

Re:ClientDataSet & Network ver slow ?

Sorry, I cannot explain the behavior you describe. A CDS is slow loading
large datasets because it was not designed to load large datasets.
However, it makes no sense that the CDS would slow down more than the
TTable when you move the data from the local drive to the network drive
under the conditions you described.
--
Bill Todd (TeamB)
TeamB cannot answer questions received via email
Camiel Wijffels writes:
Quote
Can you please help me speed up TClientDataSet?