1) If TUniQuery.Options.LocalMasterDetail is set to True, the Detail Query loads all records on the "select * from salesdetail" query (i.e., 500000 in your case).
2) In order to decrease the number of records that will be loaded on opening TUniQuery, you should set the FetchAll property to False. This can be done via TUniQuery.SpecificOptions in the following way:
Code: Select all
UniQuery1.SpecificOptions.Values['PostgreSQL.FetchAll'] := 'False';Note: setting the FetchAll property to False is useless for the detail query with the TUniQuery.Options.LocalMasterDetail property set to True, as record filtering (performed on LocalMasterDetail = True) will require loading of all records from the table at once.