Consider the following function, testfunc:

testfunc: {[] x: `aaa;
y: `bbb;
z:: `ccc;
-1 “finished!”;
}

Let’s demonstrate the placement of a breakpoint prior to the assignment of global variable z. Although there is no explicit support for breakpoints in q, insertion of non-compliant code, such as breakhere; shown below, does the job (don’t forget the trailing semicolon):

testfunc: {[] x: `aaa;
y: `bbb;
breakhere;
z:: `ccc;
-1 “finished!”
}

We are tricking q into throwing a signal ‘breakhere.

q)testfunc[] {[] x: `aaa;
y: `bbb;
breakhere;
z:: `ccc;
-1 “finished!”
}
‘breakhere
q))

At this point, we can examine the local stack.

q))x
`aaa
q))y
`bbb
q))z
()
q))

kdb has suspended execution, leaving the remaining two lines of function testfunc unexecuted. : (colon) resumes execution.

q)):
finished!
-1
q)x
‘x
q)y
‘y
q)z
`ccc
q)

See: global amend (::)

Use the -b command line argument to start kdb in read only mode, or start up with a negative port number.

one can verify the read-only mode by examining the return value of function \_

$ q -b
KDB+ 2.7 2011.02.16 Copyright (C) 1993-2011 Kx Systems
...
q)\_
1
q)

It is true that no single user query will block for more than the time specified in the -T command line argument. However, be sure to disable timeout via \T 0 prior to executing the end-of-day batch processing, or it will fail with a ‘stop error.