2022.03.17 03:23 AM
if[system"t"; | |
.z.ts:{pub'[t;value each t];@[`.;t;@[;`sym;`g#]0#];i::j;ts .z.D}; | |
upd:{[t;x] | |
if[not -16=type first first x;if[d<"d"$a:.z.P;.z.ts[]];a:"n"$a;x:$[0>type first x;a,x;(enlist(count first x)#a),x]]; | |
t insert x;if[l;l enlist (`upd;t;x);j+:1];}]; |
What do we use .z.ts to publish "value each t" to the "t" itself, I thought we just added updates to the table, not the whole table itself?
Why is this?
2022.03.21 03:21 AM - edited 2022.03.21 03:29 AM
This is batching mode when the timer t
is set. https://code.kx.com/q/basics/syscmds/#t-timer
In this mode the TP will cache data and only publish it when the timer triggers .z.ts
https://code.kx.com/q/ref/dotz/#zts-timer
In this case t
is a list of tables and it calls pub
on each of them ('
form) https://code.kx.com/q/ref/maps/#each
value
is called so that the cached data from the TP is populated in pub
to send to subscribers (RDB etc.)
Some more information on batch mode: https://code.kx.com/q/wp/tick-profiling/
q)upd'[t;value each t] //A demo 'upd' which prints the parameters sent to it
q)a:([] c1:1 2 3)
q)b:([] c2:4 5 6)
q)t:tables[] //Create list of tables
q)t
`s#`a`b
q)upd'[t;value each t]
(`a;+(,`c1)!,1 2 3)
(`b;+(,`c2)!,4 5 6)
2022.03.20 10:56 AM
Hello,
Thank you for sharing your query with us, we're working on feedback for you.
Many Thanks,
Luke
2022.03.21 03:21 AM - edited 2022.03.21 03:29 AM
This is batching mode when the timer t
is set. https://code.kx.com/q/basics/syscmds/#t-timer
In this mode the TP will cache data and only publish it when the timer triggers .z.ts
https://code.kx.com/q/ref/dotz/#zts-timer
In this case t
is a list of tables and it calls pub
on each of them ('
form) https://code.kx.com/q/ref/maps/#each
value
is called so that the cached data from the TP is populated in pub
to send to subscribers (RDB etc.)
Some more information on batch mode: https://code.kx.com/q/wp/tick-profiling/
q)upd'[t;value each t] //A demo 'upd' which prints the parameters sent to it
q)a:([] c1:1 2 3)
q)b:([] c2:4 5 6)
q)t:tables[] //Create list of tables
q)t
`s#`a`b
q)upd'[t;value each t]
(`a;+(,`c1)!,1 2 3)
(`b;+(,`c2)!,4 5 6)
EMEA
Tel: +44 (0)28 3025 2242
AMERICAS
Tel: +1 (212) 447 6700
APAC
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.