Page 1 of 1

Slowdown in zeos

Posted: 20.04.2009, 15:08
by Almindor
Hello, I'm using zeoslib 6.6.4 with postgresql 8.3 latest stable.

My problem is that while the DB works fast (I enabled logging inside postgre) zeos seems to do a huge slowdown clientside.

I do have sortfields but they're not causing it. Keyfields are causing an "internallookup" which seems to be the main culprit.

I'm using fpc 2.2.4 with lazarus trunk. Any hints on how to remedy this would be appreciated.

TZQuery.SQL:

Code: Select all

SELECT * FROM dary
WHERE (datum_prijatia >= :p_od) AND (datum_prijatia <= :p_do)
ORDER BY id
LIMIT 28
OFFSET :p_offset
Note that datum_prijatia is indexed and the index is used...

I use a very similar query with same sorting style and all for a different table and that one works quite fast so I'm sure there's some problem. The slowdown happens when I change :p_offset and do Refresh().

Posted: 20.04.2009, 22:25
by mdaems
Hi Almindor,

What are you meaning with 'internallookup'? I can't find the word in the zeoslib codebase, so I'm not sure what exactly you are refering to.

Refresh is an implicit open and close of the dataset.
The only suspicious thing I see in the code at first look is here

Code: Select all

    DisableControls;
    try
      try
        FRefreshInProgress := True;
        InternalClose;
        InternalOpen;
      finally
        FRefreshInProgress := False;
      end;

      DoBeforeScroll;
      if KeyFields <> '' then
        Found := Locate(KeyFields, KeyValues, [])   <<----
      else
        Found := False;
    finally
      EnableControls;
    end;

    if not Found then
    begin
      DoBeforeScroll;
      DoAfterScroll;
    end;
 
The code to reselect the old current row when it is still available. But I don't have an idea about the impact of this single call.

Mark