Page 1 of 1

SortedFields property of TQuery slow down performances of firebird

Posted: 08.01.2016, 19:05
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

Re: SortedFields property of TQuery slow down performances of firebird

Posted: 09.01.2016, 13:39
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

Re: SortedFields property of TQuery slow down performances of firebird

Posted: 11.01.2016, 10:00
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

Re: SortedFields property of TQuery slow down performances of firebird

Posted: 11.01.2016, 10:53
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

Re: SortedFields property of TQuery slow down performances of firebird

Posted: 11.01.2016, 14:07
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