Databricks made the SQL statement timeout generally available on November 20, 2026. It stops any SQL statement that runs longer than a limit you choose.
You can set the limit at three levels: one session, one SQL warehouse, or the whole workspace. The session value wins over the warehouse value, and the warehouse value wins over the workspace value. The default is 172,800 seconds, which is two days.
I tested the session level on a Databricks Free Edition workspace.
The test
The query cross joins 30,000 by 100,000 generated rows, hashes each pair and returns one row. With no timeout it ran about 52 seconds on a serverless SQL warehouse.
SET STATEMENT_TIMEOUT = 30 ;
SELECT count (*) AS pairs, sum(length(sha2(concat(a.id, b.id), 256))) AS checksum FROM range(0, 30000) a CROSS JOIN range(0, 100000) b;
Enter fullscreen mode
Exit fullscreen mode
What happened
It works as written. With 30 seconds, the query stopped at 30 seconds with Statement has timed out after 30 seconds.
The newest value wins.…