About Zeos TZDataSet performance
Posted: 31.03.2009, 16:49
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
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