SortedFields property of TQuery slow down performances of firebird

The official tester's forum for ZeosLib 7.1. Ask for help, post proposals or solutions.
Post Reply
louis
Expert Boarder
Expert Boarder
Posts: 107
Joined: 02.01.2009, 19:41

SortedFields property of TQuery slow down performances of firebird

Post by louis »

Hallo,
I'm rewriting my application to migrate from BDE to FB. Thinking is best, I used property "SortedFields" instead of using the clause "ORDER BY" in SQL Query and the performance of FB was running very very bad on LAN that the application seems not usable! in local, Instead, the performances seemed good.

I discovered that the origin of the problem is the property "SortedFields", I deleted all properties SortedFields and I added ORDER BY Clause on all my SQL Queries and the application is born to new life :)

Now the application is usable even on LAN.

Why? there is a bug or it's me that is wrong?

Thanks
miab3
Zeos Test Team
Zeos Test Team
Posts: 1310
Joined: 11.05.2012, 12:32
Location: Poland

Re: SortedFields property of TQuery slow down performances of firebird

Post by miab3 »

@louis

"SortedFields" acts locally(on client side), and requires a complete set of data(fetches all), FetchRow not stop download all.
Therefore, it is good for not very large amounts of data in the dataset and is then very convenient
because it works without re-downloading data from the server (similary as "Filter").
But as I wrote it works good for small datasets (or at sporadically downloading additional/new data).

Michal
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: SortedFields property of TQuery slow down performances of firebird

Post by marsupilami »

Hello louis,

depending on the things you want to do I found TZQuery to be quite slow when it has to be sorted. So if you want to sort on the client side for some reason, then I suggest you keep the record count quite slow. It seems that TZQuery will sort the whole dataset again after you insert or delete or modify a record.

With best regards,

Jan
louis
Expert Boarder
Expert Boarder
Posts: 107
Joined: 02.01.2009, 19:41

Re: SortedFields property of TQuery slow down performances of firebird

Post by louis »

Probably the property is designed to be used with no firebird databases.
With Firebird, because the fact that SortedFields property refetch all rows on dataset I think is best NOT to use this property. On clients connected by LAN the performances are very very slow even for dataset with very few rows. I have a table with 4830 rows not usable on LAN :(
With Firebird databases, IMHO, is best to perforn a new SQL Query adding the clause "ORDER BY" instead to use SortedFields property.

Thanks
miab3
Zeos Test Team
Zeos Test Team
Posts: 1310
Joined: 11.05.2012, 12:32
Location: Poland

Re: SortedFields property of TQuery slow down performances of firebird

Post by miab3 »

@louis,

Because "SortedFields" and "Filter" should be used only when needed and not when loading data into a dataset.
Ie for additional filtering or/and change order already loaded data.
When loading, use WHERE and ORDER BY Clause.

Michal
Post Reply