 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Dave Guest
|
Posted: Wed Apr 18, 2007 5:04 pm Post subject: Nested ClientDatset's and Interbase - Slow |
|
|
Hi -
Here is the background...
Delphi 2005 (with service packs installed)
Firebird (I know this is now a Borland product - but I really dont
thik this is a Firebird issue.)
I have 3 ClientDatasets which - via the usual referential rules and
use of Dataset fields are organised as follows..
CDS_Master1--CDS_Details1--->CDS_Details2
Now all is ok the first time the form is opend (no delays displaying
the data.)
When I close and re-open the form however, there is a significant and
very noticable delay before the form is opend and the data displayed.
I have tried explicitly closing all related ClientDatasets and even
explicitly commiting the transaction - nothing seems to eleviate this
delay.
Any help would be much appreciated..
Paul.
OS : Windows XP Service Pack 2
Delphi : 2005 Service Pack 3 Installed
CPU : AMD 3500+ |
|
| Back to top |
|
 |
ssamayoa Guest
|
Posted: Thu Apr 19, 2007 7:40 pm Post subject: Re: Nested ClientDatset's and Interbase - Slow |
|
|
| Quote: | CDS_Master1--CDS_Details1--->CDS_Details2
Now all is ok the first time the form is opend (no delays displaying
the data.)
When I close and re-open the form however, there is a significant and
very noticable delay before the form is opend and the data displayed.
|
Are you shure that first time doesnt take big time? May be is the main
form which could be hidding the real opening time.
Are you using TIBQuery or TIBDataset?
Do you have indexes (or foreign keys) in related tables?
--- posted by geoForum on http://delphi.newswhat.com |
|
| Back to top |
|
 |
Paul Guest
|
Posted: Mon Apr 23, 2007 1:53 pm Post subject: Re: Nested ClientDatset's and Interbase - Slow |
|
|
Firstly - thanks for your reply.
Yes - Im sure upon first running the program that initially - there is
no dicernable delay.
Not sure how abcense (or not ) of indexes should result in such a
dramatic an un-workable delay ?
I am using TIBQuery along with TIBProvider and TClientDataset
I have created a picture showing logical layout of the data and
associated components that perhaps explains the arrangement clearer.
Hre is the link..
http://img222.imageshack.us/img222/3397/cdsslowgs9.jpg
Many thanks,,.
On Thu, 19 Apr 2007 15:40:49 +0100, "ssamayoa" <nospam (AT) stopspam (DOT) com>
wrote:
| Quote: | CDS_Master1--CDS_Details1--->CDS_Details2
Now all is ok the first time the form is opend (no delays displaying
the data.)
When I close and re-open the form however, there is a significant and
very noticable delay before the form is opend and the data displayed.
Are you shure that first time doesnt take big time? May be is the main
form which could be hidding the real opening time.
Are you using TIBQuery or TIBDataset?
Do you have indexes (or foreign keys) in related tables?
--- posted by geoForum on http://delphi.newswhat.com
|
OS : Windows XP Service Pack 2
Delphi : 2005 Service Pack 3 Installed
CPU : AMD 3500+ |
|
| Back to top |
|
 |
Wayne Niddery [TeamB] Guest
|
Posted: Mon Apr 23, 2007 7:31 pm Post subject: Re: Nested ClientDatset's and Interbase - Slow |
|
|
Paul wrote:
| Quote: |
Yes - Im sure upon first running the program that initially - there is
no dicernable delay.
Not sure how abcense (or not ) of indexes should result in such a
dramatic an un-workable delay ?
I am using TIBQuery along with TIBProvider and TClientDataset
I have created a picture showing logical layout of the data and
associated components that perhaps explains the arrangement clearer.
Hre is the link..
http://img222.imageshack.us/img222/3397/cdsslowgs9.jpg
|
Your image appear to indicate you are hooking things up as recommended -
linking the base queries and using a single provider to deliver the nested
datasets to the clients. How much data are we talking about? If there is a
great deal then this would explain slow performance as ClientDatasets were
not designed to manage very large volumes of data. However that would leave
the puzzle of why it would seem to load fast the first time.
Are all the data components in the same app or is this mutlitier? Are they
directly on a form or in a datamodule? What do you have PacketRecord set to
in the master ClientDataset?
What I'm thinking is the delay is either 1) the ClientDatasets releasing all
their data is taking time or 2), if the ClientDatasets are not fetching all
data up front, then on opening the form a second time, something is causing
them to do exactly that before closing and refetching (this last would be
possible if the form is using a datamodule that is not freed between form
openings).
How are you controlling the action? You indicated you had tried playing with
the transaction directly in trying to solve this - you should not have to do
so and you *shouldn't*. The correct handling is that you simply open the
ClientDatasets when you need to, do not manually operate any of the
provider/ibquery/transaction components. Opening the CDS will cause the
provider to start a transaction, open the queries, fetch the records, and
close the transaction. If you manually intervene that will get messed up.
--
Wayne Niddery - Winwright, Inc (www.winwright.ca)
"A man is likely to mind his own business when it is worth minding,
when it is not, he takes his mind off his own meaningless affairs by
minding other people's business." - Eric Hoffer |
|
| Back to top |
|
 |
Paul Guest
|
Posted: Tue Apr 24, 2007 3:02 am Post subject: Re: Nested ClientDatset's and Interbase - Slow |
|
|
Hi Wayne -
On Mon, 23 Apr 2007 10:31:46 -0400, "Wayne Niddery [TeamB]"
<wniddery (AT) chaffaci (DOT) on.ca> wrote:
| Quote: | Paul wrote:
Yes - Im sure upon first running the program that initially - there is
no dicernable delay.
Not sure how abcense (or not ) of indexes should result in such a
dramatic an un-workable delay ?
I am using TIBQuery along with TIBProvider and TClientDataset
I have created a picture showing logical layout of the data and
associated components that perhaps explains the arrangement clearer.
Hre is the link..
http://img222.imageshack.us/img222/3397/cdsslowgs9.jpg
Your image appear to indicate you are hooking things up as recommended -
linking the base queries and using a single provider to deliver the nested
datasets to the clients. How much data are we talking about? If there is a
great deal then this would explain slow performance as ClientDatasets were
not designed to manage very large volumes of data. However that would leave
the puzzle of why it would seem to load fast the first time.
Are all the data components in the same app or is this mutlitier? Are they
directly on a form or in a datamodule? What do you have PacketRecord set to
in the master ClientDataset?
Yes - they are all in the same App. The data components are on a |
Datamodule. I guess there is a fair ammount of data involved -
however, I was thinking that it will not all befetched by virtue of
the relationship link ?
As far as Packrecords goes - I left it as the default -1.
| Quote: | What I'm thinking is the delay is either 1) the ClientDatasets releasing all
their data is taking time or 2), if the ClientDatasets are not fetching all
data up front, then on opening the form a second time, something is causing
them to do exactly that before closing and refetching (this last would be
possible if the form is using a datamodule that is not freed between form
openings).
How are you controlling the action? You indicated you had tried playing with
the transaction directly in trying to solve this - you should not have to do
so and you *shouldn't*. The correct handling is that you simply open the
ClientDatasets when you need to, do not manually operate any of the
provider/ibquery/transaction components. Opening the CDS will cause the
provider to start a transaction, open the queries, fetch the records, and
close the transaction. If you manually intervene that will get messed up.
|
I guess I only tried playing with explicitly commiting the transaction
out of desparation. This problem existed before I did that.
I can try not auto-loading the datamodule - and seeing if by
explicitly creating it at run time - it has any impact on performance.
Will try this asap .
Thanks..
OS : Windows XP Service Pack 2
Delphi : 2005 Service Pack 3 Installed
CPU : AMD 3500+ |
|
| Back to top |
|
 |
Jeff Overcash (TeamB) Guest
|
Posted: Tue Apr 24, 2007 6:41 am Post subject: Re: Nested ClientDatset's and Interbase - Slow |
|
|
Paul wrote:
| Quote: | Hi Wayne -
On Mon, 23 Apr 2007 10:31:46 -0400, "Wayne Niddery [TeamB]"
wniddery (AT) chaffaci (DOT) on.ca> wrote:
Paul wrote:
Are all the data components in the same app or is this mutlitier? Are they
directly on a form or in a datamodule? What do you have PacketRecord set to
in the master ClientDataset?
Yes - they are all in the same App. The data components are on a
Datamodule. I guess there is a fair ammount of data involved -
however, I was thinking that it will not all befetched by virtue of
the relationship link ?
|
No, the exact opposite. If packet records is set to -1 (the default) then all
data from all levels get pulled at once.
| Quote: |
As far as Packrecords goes - I left it as the default -1.
|
Then you are executing potentially 1000's of queries to open up your 4 layer
nested CDS's.
| Quote: |
What I'm thinking is the delay is either 1) the ClientDatasets releasing all
their data is taking time or 2), if the ClientDatasets are not fetching all
data up front, then on opening the form a second time, something is causing
them to do exactly that before closing and refetching (this last would be
possible if the form is using a datamodule that is not freed between form
openings).
How are you controlling the action? You indicated you had tried playing with
the transaction directly in trying to solve this - you should not have to do
so and you *shouldn't*. The correct handling is that you simply open the
ClientDatasets when you need to, do not manually operate any of the
provider/ibquery/transaction components. Opening the CDS will cause the
provider to start a transaction, open the queries, fetch the records, and
close the transaction. If you manually intervene that will get messed up.
I guess I only tried playing with explicitly commiting the transaction
out of desparation. This problem existed before I did that.
I can try not auto-loading the datamodule - and seeing if by
explicitly creating it at run time - it has any impact on performance.
Will try this asap .
|
No, while there are tricks to speed this up, you need to count how many queries
are actually executed to fill out all the datasets. In a nested dataset
situation if you have 10 records in the master result set the nested query will
run 10 times so a total of 11 queries are needed to fill out the CDS when it opens.
| Quote: |
Thanks..
OS : Windows XP Service Pack 2
Delphi : 2005 Service Pack 3 Installed
CPU : AMD 3500+
|
--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
A human being should be able to change a diaper, plan an invasion, butcher
a hog, conn a ship, design a building, write a sonnet, balance accounts, build
a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act
alone, solve equations, analyze a new problem, pitch manure, program a computer,
cook a tasty meal, fight efficiently, die gallantly. Specialization is for
insects. (RAH) |
|
| Back to top |
|
 |
Paul Guest
|
Posted: Tue Apr 24, 2007 2:24 pm Post subject: Re: Nested ClientDatset's and Interbase - Slow |
|
|
While I must confess to not fully understanding the way in which
ClientDatasets operate - its clear that my approach needs to be
modified.
As far as I can see - I need either to modify the UI so that there is
no need to display all the data on-screen at once (some UI slight of
hand) or learn better techniques when handling large ammounts of data.
I really only used ClientDatasets as they handle a lot of tedious
things - like transaction control. So either they are the wrong tools
for the job - or I am not using them corrently.
And now that you point these things out Jeff - I seem to remember a
similar post I submitted some time ago (forgive me for my repitition -
but I have not dealt with ClientDatasets for some time.)
I guess the thing that confounded me was - why is there no initial
delay when loading the data ? Intuitively you would expect the results
(if anything) would be cashed - so the process should be quicker when
subsequently repeated?
Anyway, found an interesting article with regards related matters...
http://www.builderau.com.au/program/web/soa/Maximise-DataSnap-efficiency-in-Delphi/0,339024632,320271368,00.htm
So I can see there is mucvh to consider and I'm going to have to
re-think my approach.
Many thanks for the replies guys..
Regards..
Paul.
On Mon, 23 Apr 2007 21:41:26 -0400, "Jeff Overcash (TeamB)"
<jeffovercash (AT) mindspring (DOT) com> wrote:
| Quote: | Paul wrote:
Hi Wayne -
On Mon, 23 Apr 2007 10:31:46 -0400, "Wayne Niddery [TeamB]"
wniddery (AT) chaffaci (DOT) on.ca> wrote:
Paul wrote:
Are all the data components in the same app or is this mutlitier? Are they
directly on a form or in a datamodule? What do you have PacketRecord set to
in the master ClientDataset?
Yes - they are all in the same App. The data components are on a
Datamodule. I guess there is a fair ammount of data involved -
however, I was thinking that it will not all befetched by virtue of
the relationship link ?
No, the exact opposite. If packet records is set to -1 (the default) then all
data from all levels get pulled at once.
As far as Packrecords goes - I left it as the default -1.
Then you are executing potentially 1000's of queries to open up your 4 layer
nested CDS's.
What I'm thinking is the delay is either 1) the ClientDatasets releasing all
their data is taking time or 2), if the ClientDatasets are not fetching all
data up front, then on opening the form a second time, something is causing
them to do exactly that before closing and refetching (this last would be
possible if the form is using a datamodule that is not freed between form
openings).
How are you controlling the action? You indicated you had tried playing with
the transaction directly in trying to solve this - you should not have to do
so and you *shouldn't*. The correct handling is that you simply open the
ClientDatasets when you need to, do not manually operate any of the
provider/ibquery/transaction components. Opening the CDS will cause the
provider to start a transaction, open the queries, fetch the records, and
close the transaction. If you manually intervene that will get messed up.
I guess I only tried playing with explicitly commiting the transaction
out of desparation. This problem existed before I did that.
I can try not auto-loading the datamodule - and seeing if by
explicitly creating it at run time - it has any impact on performance.
Will try this asap .
No, while there are tricks to speed this up, you need to count how many queries
are actually executed to fill out all the datasets. In a nested dataset
situation if you have 10 records in the master result set the nested query will
run 10 times so a total of 11 queries are needed to fill out the CDS when it opens.
Thanks..
OS : Windows XP Service Pack 2
Delphi : 2005 Service Pack 3 Installed
CPU : AMD 3500+
|
OS : Windows XP Service Pack 2
Delphi : 2005 Service Pack 3 Installed
CPU : AMD 3500+ |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|