Cancel, Reset, and Timeouts¶
This page describes how to cancel or reset a query in the Scratchpad, how to set an execution timeout, and how to manage long-running queries.
Reset or cancel a query¶
To reset or cancel a query in the Query panel or Scratchpad panel, click Reset or Cancel in the bottom-left corner of the window.

Queries in the Query panel run through your Scratchpad, so these buttons act on the Scratchpad process for both panels.
- Reset restarts the scratchpad pod, clearing the entire scratchpad state. All progress is lost, including any variables you have defined in q or Python and any files in
/tmp. Use this to reset an unresponsive scratchpad, free up memory, recover from accidental overwrites, or ensure your code runs without relying on previously defined global variables. Note that it takes up to 30 seconds for the scratchpad to become responsive after restarting. - Cancel stops the operation the scratchpad is currently processing, such as a long-running query or an infinite loop. This applies whether that is a database query, scratchpad query, test deploy, or even a query from VS Code or a different browser. Cancel keeps your scratchpad state. Canceling long-running queries might not free up resources, see Cancel button limitation for details.
Reset and cancel both clear all pending scratchpad operations. This ensures that if a problematic request was sent repeatedly, restarting the scratchpad won’t immediately re-enter the same faulty state.
Note
Canceled database queries might continue running on the database until they complete or reach the execution timeout set for that query.
Execution timeout¶
Use the Execution Timeout field, in the Output Panel, to set a custom timeout for queries executed in both the Query panel and the Scratchpad panel.
You can specify a duration in Seconds, Minutes or Hours.
- If the timeout is too short, the query returns an error.
- When a custom timeout value is set, that value is used for subsequent queries from that scratchpad.
- Each new scratchpad you open defaults to a 60-second execution timeout. An administrator can change this default by setting the
SCRATCHPAD_TIMEOUT_SECONDSenvironment variable in the Scratchpad Manager deployment.
Manage long-running queries and session timeouts¶
When a query runs for a long time, keep the following three things in mind.
Cancel button limitation¶
The Scratchpad cancel button cannot cancel a query that has been sent to the database. The scratchpad becomes responsive again, but the query continues running on the DAP (Data Access Process) until it completes or times out. The scratchpad does not receive the result of canceled database queries.
Single sign-on (SSO) session timeout risk¶
For long-running queries, ensure your Keycloak SSO session settings are configured to exceed the expected query duration. Otherwise, you might be signed out of kdb Insights Enterprise before the query completes, even if the timeout value is sufficient.
The following Keycloak session properties must be set to values longer than the expected query time (setting these to zero might not be sufficient):
SSO Session IdleSSO Session MaximumClient Session Idle
Scratchpad inactivity timeout¶
You must also ensure the Scratchpad Manager’s inactivity timeout is longer than the expected query duration. Any time spent waiting for a query response is counted as inactivity, which could cause the session to be terminated prematurely.
To configure this:
-
At install time, set the following in the
values.yamlfile, as described in Applying configuration changes:kxi-scratchpad-manager: scratchpadMaxInactivityMins: 120 -
To update a running instance, edit the equivalent
SCRATCHPAD_MAX_INACTIVITY_MINSenvironment variable in the Scratchpad deployment.