delphi - TTable and lookup fields performance issue -
i have ttable (actually unidac tunitable) has table fields plus 2 lookup fields table (mysql). have set correct indexes , table loads fast. problem when manually edit field like
table1.fieldbyname('discount_value').asinteger := 10; everytime command executed without post() goes slow. if remove 2 lookup fields fine - super fast.
it looks somehow lookup field loaded on every record edit before post() executed.
is there way prevent or somehow retrieve lookup fields once , cache without loading again , again?
you can experiment tfield.lookupcache property, controls whether values of lookup field cached or not.
determines whether values of lookup field cached or looked dynamically every time current record in dataset changes.
set lookupcache true cache values of lookup field when lookupdataset unlikely change , number of distinct lookup values small. caching lookup values can speed performance, because lookup values every set of lookupkeyfields values preloaded when dataset opened. when current record in dataset changes, field object can locate value in cache, rather accessing lookupdataset. performance improvement dramatic if lookupdataset on network access slow.
there more information available in documentation linked above, including information performance considerations , manually refreshing lookuplist @ runtime.
Comments
Post a Comment