Master - Detail using TMyTable
Posted: Fri 14 Nov 2008 02:51
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?
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?