Subject UDF "returning" BLOB slow after first call
Author

Hi all,


I'm using Firebird 2.5.8 and wrote a UDF that "returns" a large (~60MB) BLOB via an output parameter that's a pointer to a blobcallback by repeatedly calling blob_put_segment. The instructions for doing so I took from: https://www.ibphoenix.com/files/Writing-External-Functions.pdf.


The first time I call this function from any connected client, it returns fast (~80ms). Every time after that, it's many times slower (~15s). Only when all clients have disconnected, the server seems to reset in a way, after which a single next call is fast again.


It seems to be that call to blob_put_segment that becomes slow. At first usage of the UDF it's almost instant, and after that it takes 15ms for every invocation.


What causes this and can I avoid it?


Thanks!