cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

SQL Warehouse Timeout / Prevent Long Running Queries

Kayla
Valued Contributor

We have an external service connecting to a SQL Warehouse, running a query that normally lasts 30 minutes.
On occasion an error occurs and it will run for 6 hours.
This happens overnight and is contributing to a larger bill. Is there any way to force long running queries to time out or the SQL Warehouse to have a limited keep-alive time even if there are active queries?

1 ACCEPTED SOLUTION

Accepted Solutions

lucasrocha
Contributor II

Hello @Kayla , I hope this message finds you well.

Have you tried the STATEMENT_TIMEOUT?
The STATEMENT_TIMEOUT configuration parameter sets a timeout value in seconds. Any Databricks SQL statement with a wall clock run time exceeding the value is timed out.
You can set this parameter at the session level using the SET statement and at the global level using Configure SQL parameters or SQL Warehouses API.

doc.https://docs.databricks.com/en/sql/language-manual/parameters/statement_timeout.html#statement_timeo...

Best regards,
Lucas Rocha

View solution in original post

3 REPLIES 3

lucasrocha
Contributor II

Hello @Kayla , I hope this message finds you well.

Have you tried the STATEMENT_TIMEOUT?
The STATEMENT_TIMEOUT configuration parameter sets a timeout value in seconds. Any Databricks SQL statement with a wall clock run time exceeding the value is timed out.
You can set this parameter at the session level using the SET statement and at the global level using Configure SQL parameters or SQL Warehouses API.

doc.https://docs.databricks.com/en/sql/language-manual/parameters/statement_timeout.html#statement_timeo...

Best regards,
Lucas Rocha

raphaelblg
Honored Contributor II

Hello @Kayla, maybe the STATEMENT_TIMEOUT configuration parameter is what you're looking for. 

This parameter can be set at session or global level.

 

Best regards,

Raphael Balogo
Sr. Technical Solutions Engineer
Databricks

Kayla
Valued Contributor

@lucasrocha @raphaelblg That is exactly what I was hoping to find. Thank you!

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group