Page 1 of 1

TZQuery opens slow

Posted: 07.10.2005, 14:27
by john_pa3erp
Hi ZEOS-team,

using D7, FB1.5 via internetconnection.

I have created a small testproject with different DBO's, like Borland Interbase, MDO, ZEOS, FBPlus and IBO.

Query: select * from TABLE

Sequence:
Open connection, record time A, Set Query Active, record time B, close Query, close connection, show elapsed time (B-A).

All DBO's give about the same result on all tables: less then 1 second.
Except ZEOS on one table: 8 seconds!!

If leaving connection open and reopening, time is OK.

Tested against other server with same database: same result.
Recreated table with other name: same result.
Emptied table: same result!
After Backup/Restore: same result.

Dropped 25 fields, 26 left: 4 seconds
Dropped again 16 fields, 10 fields left: 1 second.

Is ZEOS getting significantly slower when the number of fields is increasing?

Thanks in advance!

John

Posted: 07.10.2005, 15:36
by guyvdb
Hello,

we did also some tests and came to the same conclusion.
'qry.open' is very slow with ZEOS.

Speed is significantly better with 'ADO' and 'SQLDirect'
Disabling the debug define in zeos.inc doesn't change anything.

Posted: 07.10.2005, 20:24
by john_pa3erp
guyvdb wrote:Hello,
we did also some tests and came to the same conclusion.
'qry.open' is very slow with ZEOS.
Speed is significantly better with 'ADO' and 'SQLDirect'
Disabling the debug define in zeos.inc doesn't change anything.
Hi,

Well, the first opening anyway.

Found another thing using a packetsniffer: ZEOS created about 10 times as much TCP-traffic as other DBO's...

Tested packet sniffing with sequence:
Connect to DB, open R/O query, Close Query, Close Connection
ZEOS: 830 packets
MDO: 80 packets

Could debug-code be the reason for this?

regards,
John

Posted: 10.10.2005, 07:00
by Terence
Uhm ..that would be really interesting because if that is true, its a main bottleneck for performance!
Did you check if the "additional" traffic is constant or increases proportional to the amount of sql results?

Furthermore can you check if that "other" ways to query the data have a feature like compressed data transfer between client and server activated?
I am not sure if that i supported by the zeos native interface, but for larger result sets it could reduce the tcp packet amount because having less payload.

Posted: 10.10.2005, 11:17
by john_pa3erp
It is not the amount of resultrecords, it is Zeos asking for fielddefinitions.
The tracer shows this SQL taking so much time:

SELECT
a.RDB$RELATION_NAME, a.RDB$FIELD_NAME, a.RDB$FIELD_POSITION,
a.RDB$NULL_FLAG, a.RDB$DEFAULT_VALUE, b. RDB$FIELD_LENGTH,
b.RDB$FIELD_SCALE, c.RDB$TYPE_NAME, b.RDB$FIELD_TYPE,
b.RDB$FIELD_SUB_TYPE, b.RDB$DESCRIPTION, b.RDB$CHARACTER_LENGTH,
b.RDB$FIELD_PRECISION, a.RDB$DEFAULT_SOURCE,
b.RDB$DEFAULT_SOURCE as RDB$DEFAULT_SOURCE_DOMAIN
FROM RDB$RELATION_FIELDS a
JOIN RDB$FIELDS b
ON (b.RDB$FIELD_NAME = a.RDB$FIELD_SOURCE)
LEFT JOIN RDB$TYPES c
ON (b.RDB$FIELD_TYPE = c.RDB$TYPE
and c.RDB$FIELD_NAME = 'RDB$FIELD_TYPE')
WHERE a.RDB$RELATION_NAME = 'USERS'
ORDER BY a.RDB$RELATION_NAME, a.RDB$FIELD_POSITION


It is SQL generated by ZEOS when opening table 'USERS' for the first time. I guess its asking for fielddefinitions. When opening the same table later, time is ok.

It does this on any table in database that is opened for the first time. Could it have anything to do with the gds32.dll that is being used? Its a renamed fbembed.dll.... ??

Posted: 10.10.2005, 11:35
by Terence
hmm. i have no idea how the driver is implemented, but why shall a query ask for field definitions? I would expect the whole query is evaluated on server side, such the only thing which has to be send back from server side is the results set. I would expect field definitions only need for (readonly=false) furthemore TTable objects.
Of course you should prepare query objects and reuse them if looping for same sql but different values - then also use sql params to modify.