Bad performace on TZAbstractRODataset when connected to grid

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
mscherr
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 06.02.2009, 09:25
Location: Grevenmacher

Bad performace on TZAbstractRODataset when connected to grid

Post by mscherr »

Hi.

I'm trying to port a BDE/Firebird 2.1 app to ZEOS.

Using a TZQuery connected to a DBGrid (SMDBGrid but that doesn't matter), opening a table with about 10k records lasts too long.

In the VCL after opening the dataset, TCustomDBGrid.UpdateScrollBar is called which calls Self.VisibleRowCount -> TZAbstractRODataset.GetRecordCount -> TZAbstractRODataset.FetchRows(0) which fetches all the records in...

Code: Select all

...
if RowCount = 0 then
begin
  while FetchOneRow do; // <- !!!
  Result := True;
end
...
...well, so the performance, compared to the old BDE TQuery, is very bad. Even setting FetchRows to i.e. 100 is not optimal because then RecordCount displays only the fetched number of records and not the correct number. There is no way to get these values using the underlying Firebird API like the old BDE components did?

Michael
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Well, I don't know the FB API very well. But if there's a function that can return the number of available resutls before fetching, it may be possible to implement this.
What should be done then?
- Add a property to the IZDatabaseInfo to indicate if the API supports GetRecordCount (or something similar)
- Add a (usually unsupported) function to the dbcresultset interfaces that uses the right API call from the plain API to retrieve the number of records in the resultset
- Change the Getrecordcount function to use the resultset's new function if the metadata indicates this function is supported.
- Testtesttesttest... I don't know the side effects...

Mark
Image
alexeevd
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 01.11.2009, 18:47

Re: Bad performace on TZAbstractRODataset when connected to

Post by alexeevd »

mscherr wrote:Hi.
There is no way to get these values using the underlying Firebird API like the old BDE components did?

Michael
BDE developed before FB born. TQuery must work like zeos query, but TTable use not-trivial "live" cache on table index and use additional select count(*)... query when access to RecordCount (look to SQLMonitor).
Locked