About Zeos TZDataSet performance

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

Moderators: gto, EgonHugeist

Post Reply
personalsoft_fabiano
Fresh Boarder
Fresh Boarder
Posts: 15
Joined: 13.02.2009, 18:55
Location: Americana/SP

About Zeos TZDataSet performance

Post by personalsoft_fabiano »

Hi all,

I had read some posts where some people complains about Zeos performance.

When i started to use Zeos in my application, i noticed the first time it access a table using a TZQuery or TZTable, it takes a long time to return the result, specially if you are over a slow network... Next time it access the same table, it is very fast.

Tracing this behavior, i got to TZAbstractRODataset implementation, and i see there is a place where it reads the metadata to decide if a column is readonly or required and to get its precision. This operation triggers a new query to the database to retrieve metadata, and causes a significant delay in the regular operation.

This behavior can be turned off with the FOSNOMETA directive, and in Zeos.inc it says "PATCH TO DO NO METADATALOADING / UNTESTED HIGH RISK", what i presume scares any brave user who wants to give it a try :-)

As i had a great performance improvement in my application turning this directive on, and the only thing it affects is that when i open a TZDataSet the ReadOnly, Required and Precision properties will receive its default values, i think users should be encouraged to activate it, not the opposite. I can agree the metadata loading behaviour is usefull in design-time, when i´m adding columns to my datasets, but in runtime the dataset columns are usually stored in the application, so there are many unecessary queries to the database happening under te hood.

As this behaviour is related just to TDataSet descendents, i would even go further and think about creating a property in TZConnection to turn this on/off, this way one could turn it on when when designing the application, and turn it off when running it.

Thoughts?

Regards,

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

Post by mdaems »

what i presume scares any brave user who wants to give it a try :-)
I suppose that's exactly the purpose : telling you not to use it without testing your specific case. As the zeoslib design isn't made with this switch in mind.

If it could be turned of by just setting a connection property that would be superb.

However, don't think this has only design time purposes. It's also useful on runtime when the query columns are not known at design time and you want to have an updatable query.

Performance also depends on the database server you're using. Some databases serve the metadata info quite fast. Others need complex queries.

Mark
Image
personalsoft_fabiano
Fresh Boarder
Fresh Boarder
Posts: 15
Joined: 13.02.2009, 18:55
Location: Americana/SP

Post by personalsoft_fabiano »

I can create the connection property and implement the necessary code, and send the patches for your approval.

Does this change (and property name) need to be approved for someone?

Regards,

Fabiano.
Post Reply