Executing queries against a historical (disk-based) KDB database can be computationally expensive - both in time and space. Rather than tautologically execute the query, it is best to cache the result if the query needs to executed again. I wanted to pass the result (kdb table) to a remote function on another Q process on another server. Passing the table to an IPC handle is trivial but to pass the table as an argument to a remote function is tricky.
In true blue peter style, here is one I made earlier:
h:hopen `someserver:3333
tbl:select avg price from ([]price:10?1.10)
h "add ",-3!`int$-8!tbl
This code serializes the table, then casts the serialized binary data to a list of integers to be passed to the remote function called add
On the other side of the IPC handle, the add function will look like:
add:{[data] tbl: -9!4h$data; ... }
Enjoy!
No comments:
Post a Comment