Slowdown in zeos

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
Almindor
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 26.06.2007, 16:30

Slowdown in zeos

Post 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().
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
Post Reply