Page 1 of 1

overhead when using CDS

Posted: Wed 16 Jun 2010 15:03
by jkuiper
If I use CDS (Clientdataset) and TMyQuery in the same application, isn't there a little overhead. As far as I can see TMyQuery read its data from the MySQL table, put them in memory and closes the table from the server. So there's no cursor open on the database table. If there will be an insert/update/delete TMyQuery creates an SQL to refresh the table on the server with the updated records.
If I using CDS in combination with TMyQuery, only the dataset is moving to another component but still in memory.

Am I right and will CDS only usefull to n-tier when I using TMyQuery?

Posted: Thu 17 Jun 2010 10:00
by Dimon
When you are using TClientDataset with TMyQuery recordset is kept in memory of both components. To increase performance you can connect DataSource directly to TMyQuery.

Posted: Thu 17 Jun 2010 10:15
by jkuiper
You say: Closing TMyQuery still have records in memory. What is TMyquery.close doing? As far as I know closing the dataset and clear any records in it.

Posted: Fri 18 Jun 2010 08:24
by Dimon
No, after closing TMyQuery frees memory.

Posted: Fri 18 Jun 2010 15:51
by jkuiper
Okay. Now I know I can better use TMyquery instead of TVirtualTable or CDS, because TMyQuery is doing the same thing. Only uses CDS with TMyQuery when creating a n-tier application. :D