Subject Re: How to convert set of integers into a BLOB in SP or UDF
Author Roman Rokytskyy
> >Fetching 500 rows with 4 bytes of payload is not very nice idea.
> I'm not sure why you say this. Pure esthetics?
> Seems to me if you are interested in efficiency of fetching results
> set it would not be worth the trouble. Reducing TCP packet
> transmissions would be the way to highest efficiency, IMO. Some
> quick estimation: Say you use TCP packets on the large side, such as
> 1400 bytes per transmission. Your 500 resulting records would be
> returned about 120 per packet (12 bytes taken per PK) using about 5
> transmissions. In comparison, using a blob field filled and returned
> as one record would take about 7 bytes per resulting PK value. That
> works out to abut 70 PKs per packet (7 bytes taken per PK), or
> 7 transmissions.

Did I understand you correctly that I can specify how many rows are
returned in one fetch? Let's say I execute:

while(isc_dsql_fetch(...) == 0) {
// do something with my data

Will Firebird somehow optimize each isc_dsql_fetch somehow that it
will transmit 120 records per packet instead of 120 packets for each
record? I am not specialist in TCP/IP, but I hardly see how Firebird
can pack 120 records into one packet, if client asked for the first
row only.

> Hardly worth the effort to reduce from 7 transmissions to 5, is it?

Sure, if this is the case, there's no point to optimize anything. But
if it is about reducing transmitions from 500 to 7, it is wort it,
isn't it?