Hi
(2) - I would have a separate process maintain them to remove load from the RDB. Given you have a gateway you can still access them by the same entry point, just the gateway will route the request to the caching process.
At end-of-day you could either rebuild the tables in whichever process you have writing the data to the HDB (either the RDB or WDB), or you could do it from your caching process as well (personally I would use the first approach). You just need to make sure the tables are fully up-to-date before writing i.e. all the ticks prior to .u.end have been processed.
(5) Yes - not sure of what else will fail, but the "key flip value" bit will not produce the correct result on a keyed table. The purpose of this line is to get the column names of the table, on a keyed table it will only get non-key columns of the table. You could try changing this bit just to use cols instead, but I'm not sure of the other side effects.
Either way, keying the table in the TP probably isn't actually want you want to do - you want to key the table in the consumers of the data. So you can modify the RDB to maintain a keyed version of the table without changing the TP code.
(6) You can write a query to access both directly from the gateway, but you have to bear in mind that the RDB and HDB have different requirements in terms of where clause order (RDB is usually "where sym ..., ...", HDB is usually "where date ..., sym ... , ..."
An ugly way to do it is to form a query something like (untested)
{[starttime; endtime]
$[.proc.proctype=`rdb;
select by time:1 xbar time.date,sym from quote where time within (starttime;endtime);
select by time:1 xbar time.date,sym from quote where date within `date$(starttime; endtime), time within (starttime;endtime)]}
A better approach is to create functions in both the rdb and hdb, which have the same signature (same params, same return value shape) but are optimised for the particular process, and then call the function e.g.
.gw.syncexec["bucketquote[2017.07.01T00:00:00.000; 2017.08.02T23:59:59.000]";`hdb`rdb]
The function definition can be put in code/hdb and code/rdb respectively.
Note also with .gw.syncexec:
- the order of the process types requested is important - `hdb`rdb will return hdb results with rdb appended, which is probably what you want
- if you want a custom join function you can use
.gw.syncexecj
whose format is
[query; processes; join function to use]
join function is a monadic function which will be supplied with the list of results retrieved, in the correct order. The default in .gw.syncexec is just raze
Thanks
Jonny