SahidGuest
Is there a setting wihin kdb+ where I can schedule regular database tasks?
kdb+ does not have a scheduler, it provides a timer which can be used to schedule simple regular tasks.
The \t timer is specified in milliseconds, saying how long the delay between firings are.
The event handler .z.ts can then be defined to perform an action every X milliseconds.
e.g.
\t can be used to either find the current timer setting (0 is off) or set the between
`
q)\t
0i
q) / Set our timer handler to show the current time
q).z.ts:{show .z.t}
q)\t 11000
q)15:40:58.353
15:41:09.353
15:41:20.352
q)\t 5000
q)15:41:23.724
15:41:28.723
15:41:33.723`
Turn it off, then set timer to increment a variable, restart timer to trigger every 100 milliseconds.
`
q)\t 0
q)a:1
q).z.ts:{a::a+1}
q)\t 100
q)a
10
q)a
17
q)a
25
q)a
32`
Many people use cron.tab or autosys for scheduled tasks. From a shell script they can then run q scripts and return exit codes to log success.