When I open a child form containing two TMyTables set up as a Master Detail using the MasterSource and MasterFields properties, the form takes a long time to open. The SQL in the master is "select * from x_areas where JobID = :ijparam" and the SQL in the detail is "select * from x_items where Remove = 0". If I use DBMonitor to look at what gets run I see that a query getting all the data from the detail is running "select * from x_items", which takes awhile to run about 36 seconds. Once this finishes I then see the select from the master and then the select from the detail based upon the fields in the MasterFields property.
From the information in your forums it acts like this because MySQL does not use cursors so it has to get all the data out of the table. Is this statement correct? Is there any way around this? Is there any way I can force it to only get a subset of the table? Say select * from x_items where Remove = 0 and Job_ID = :iparam instead of the whole table? This is a big table.
And would connection pooling speed up my get here as well?
Master - Detail using TMyTable
-
Gary Wiederhold
- Posts: 2
- Joined: Fri 14 Nov 2008 02:28
Version of MyDAC
MyDAC version 5.10.0.10 for Delphi 7.
-
swierzbicki
- Posts: 451
- Joined: Wed 19 Jan 2005 09:59
You should try a newer version of MyDAC. I know that devart did bug fixes and enhancement on this since (5.20 branch, 5.50 branch). You should test your project with a newer version. If 'm not wrong the 5.70 branch looks to be the last one.
Ps : be aware of this, in version prior to 5.50 parameters were refreshed on all cases. Starting from 5.50 this is no more the case, you should add this : DBAccess.RefreshParamsOnInsert:=true;
Ps : be aware of this, in version prior to 5.50 parameters were refreshed on all cases. Starting from 5.50 this is no more the case, you should add this : DBAccess.RefreshParamsOnInsert:=true;
Re: Master - Detail using TMyTable
If you use master/detail relationship between tables, TMyTable should get only data that is connected with master record.Gary Wiederhold wrote:From the information in your forums it acts like this because MySQL does not use cursors so it has to get all the data out of the table. Is this statement correct? Is there any way around this? Is there any way I can force it to only get a subset of the table? Say select * from x_items where Remove = 0 and Job_ID = :iparam instead of the whole table? This is a big table.
Please check if the latest MyDAC build solves the problem.