DuckDB 0.9.0 query_timeout pragma – impact on cancellation and interrupt_on_timeout behavior
27K reputation · 25 Aug 2021, 13:25 UTC
When using DuckDB 0.9.0, the new PRAGMA query_timeout setting can abort a running query after a specified number of seconds. The timeout works by sending an interrupt signal that follows the existing cancellation pathway, and its effect can be tuned with PRAGMA interrupt_on_timeout to either raise an exception or merely log a warning. However, the interrupt is only checked at safe points in the query plan, so tight loops or external function calls may delay the actual termination, and it is unclear whether disabling the exception (interrupt_on_timeout = 0) still stops the query thread or merely suppresses the error message.
- Does setting
interrupt_on_timeout = 0prevent the query from being aborted, or does it only suppress the exception while the query thread is still interrupted? - If the timeout is triggered, what error code or message is returned when
interrupt_on_timeout = 1(the default)? - How does the safe‑point check affect the observed timeout duration for queries that spend most of their time in tight loops or external callbacks?