When would you use stored procedures, UDFs, or external functions in Snowflake?

Quick Overview

Explain when to choose a stored procedure, a user-defined function or an external function in Snowflake. It tests how each one is invoked from SQL, which of them can change data, where the code runs, and the latency and governance costs of calling an outside service.

When would you use stored procedures, UDFs, or external functions in Snowflake?

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: medium

Interview Round: Other

When would you use stored procedures, UDFs, or external functions in Snowflake? ```hint Compare them on three axes Look at how each one is called from SQL, whether it can change data, and where its code actually runs. ``` ### What a Strong Answer Covers - What each object is and how it is invoked from SQL - Which of them can modify data or run several statements in sequence - When logic has to run outside Snowflake and what that costs - A clear rule for choosing among the three, with an example use for each ### Follow-up Questions - Why can't you call a stored procedure inside a SELECT, and how do you use its result in a later query? - What is the difference between caller's rights and owner's rights procedures? - When would you write a table function (UDTF) instead of a scalar UDF? - You need to score an ML model on a large table. Would you use an external function, a Python UDF or something else?

Overview: Explain when to choose a stored procedure, a user-defined function or an external function in Snowflake. It tests how each one is invoked from SQL, which of them can change data, where the code runs, and the latency and governance costs of calling an outside service.

PracHub logo
General
Nov 24, 2026
mediumData ScientistOtherData Manipulation (SQL/Python)
0
0

When would you use stored procedures, UDFs, or external functions in Snowflake?

What a Strong Answer Covers Guidance

  • What each object is and how it is invoked from SQL
  • Which of them can modify data or run several statements in sequence
  • When logic has to run outside Snowflake and what that costs
  • A clear rule for choosing among the three, with an example use for each

Follow-up Questions Guidance

  • Why can't you call a stored procedure inside a SELECT, and how do you use its result in a later query?
  • What is the difference between caller's rights and owner's rights procedures?
  • When would you write a table function (UDTF) instead of a scalar UDF?
  • You need to score an ML model on a large table. Would you use an external function, a Python UDF or something else?