简体   繁体   中英

FireDac FDTable Delay Open/Fetch records

For some reason, I need to use FDTable in a Delphi Project to Fetch a large number of records (Interbase Database), unfortunately, to open the FDTable takes too much time (up to 2min and sometimes more) even worse when to ApplyUpdate, I tried everything possible by changing the fetch options: Recsmax, Rowsize, Mode, etc. as mention on some pages, Like: https://docwiki.embarcadero.com/RADStudio/Sydney/en/Fetching_Rows_(FireDAC)

Set the RecsMax Option to a small value (50 or 100) helps a lot with the performance but it will not fetch 1 record with Filter applied even with FetchAll. As I mention before I need to do this with FDtable, FDQuery is not an option as we all know dealing with queries is better.

Is there a recommendation to smoothly open and fetch the data (100k+ records)? It's Possible to fetch records with Filter + RecsMax?

The query table must have Primary key. You can configure TFDTable as follows

  FDTable1.FetchOptions.Items := [fiMeta];  // at least
  FDTable1.FetchOptions.Unidirectional := False;
  FDTable1.FetchOptions.CursorKind := ckAutomatic; // or ckDynamic
  FDTable1.CachedUpdates := False;
  // LiveWindowParanoic
  // When it is false there are problems with Locate and Recno
  FDTable1.FetchOptions.LiveWindowParanoic := False // Play with True/False.

This is the configuration for the best performance

FDTable component is there mainly for BDE compatibility.

FDQuery with "select * from Table1" is exactly the same thing as using FDTable, but you can filter resultset on server side.

100k+ records is a lot of data to transfer, blobs add additional overhead, as they're usually fetched separately. I suggest you rethink the functionality design.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM