Shane B
Shane B

Reputation: 1

Infinite loops in SnowFlake stored procedures (or CTEs)

What would be the likely outcome of a SnowFlake stored procedure that entered an infinite loop? Would it get automatically terminated after a particular time limit or processing resource consumption limit?

Similarly, in cases where you might have SnowFlake recursive CTE's - is there any system level safeguards against an infinite loop affecting other queries running on the Data Warehouse?

Upvotes: 0

Views: 594

Answers (1)

Mike Walton
Mike Walton

Reputation: 7369

There is a setting that can be set for Account, User, or Session that sets the maxiumum amount of time that a query can execute:

https://docs.snowflake.net/manuals/sql-reference/parameters.html#statement-timeout-in-seconds

That's the easiest way to prevent this. By default, it's 48 hours, so if you want to use this for these specific use-cases, you should likely reduce that to a more reasonable amount of time.

Upvotes: 1

Related Questions