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
Contributor III

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
New Contributor III
New Contributor III

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
New Contributor III
New Contributor III

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
Honored Contributor

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
Contributor III

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

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!