1

I am using Delphi 10 Seattle, FireDac, Oracle Database and the TMS Components.

I am looking for a method that allows me to load data from my dataset/query and put it on a StringGrid on demand. I think the correct expression would be paging.

When i have a huge number of records (5000+) my application is freezing (~5s) till it loads all of them in the grid.

I've read the wiki post from Embarcadero about Fetching Rows but i didn't find a solution there.

I tried different combinations of the TFDQuery FetchOptions and ResourceOptions but without luck.

I noticed that the SQLDeveloper by Oracle performs exactly how i want my application to behave.

I've recorded this short clip to demonstrate how the SQLDeveloper loads massive amounds of records: https://gfycat.com/BlankOrganicIndianpalmsquirrel

It first loads 50 records and as I scroll through the grid the other records get loaded.

So the question is how can i get the same polling technique like SQLDeveloper. Thanks!

EDIT: Was using LiveBindings. Switched to db-aware components and it looks fast as lightning now.

ChrisB
  • 2,497
  • 2
  • 24
  • 43
  • 1
    Are you using a db-aware grid or LiveBindings (which seems way slower, ime, particularly if there are more than a few columns). 5k records shouldn't be a problem, speed wise (50k might start to be). Anyway, it's best to get the data from the server in a background thread, then update the GUI when that's done. – MartynA Jan 26 '16 at 19:32
  • 1
    Use a TDBGrid, which does all of this buffering for you. – Ken White Jan 26 '16 at 19:37
  • @MartynA I am using LiveBindings and the TMS non-db-aware grid – ChrisB Jan 26 '16 at 19:46
  • @KenWhite I'll have a look at TDBGrid and the db-aware component TMS offers. – ChrisB Jan 26 '16 at 19:46
  • 1
    What @KenWhite says. If you're interested in performance, grid-wise, forget LiveBindings (and TMS )and take a look at the Developer Express TcxGrid. Their libraries are pricey but are my first choice every time. – MartynA Jan 26 '16 at 19:49
  • @MartynA Thank you and also Ken. I switched to the DB aware components and it doesn't even take 1s to load everything. TIL: Do not use LiveBindings. – ChrisB Jan 26 '16 at 19:57
  • 1
    Glad you got an improvement. Fwiw, I think LiveBindings is a pretty amazing bit of technology, considering what it can do (incl platform-independence). But grid displays aren't its strong point. – MartynA Jan 26 '16 at 20:01
  • 1
    As you've solved this yourself, I think you should post your solution as an answer, for the benefit of future readers with a similar problem. – MartynA Jan 26 '16 at 20:14

1 Answers1

2

As mentioned in the comments i gained a huge performance speed by switching from LiveBindings to the DB-aware component DBGrid.

For smooth scrolling i used this SO answer: Delphi dbgrid continuous scrolling

Community
  • 1
  • 1
ChrisB
  • 2,497
  • 2
  • 24
  • 43