What are table functions (TVFs) in BigQuery, and how do they differ from views and scalar UDFs?

Quick Overview

Asks what BigQuery table-valued functions are and how they compare with views and scalar user-defined functions. Tests understanding of parameterized SQL, where each object can be used in a query, and the cost and access-control effects of choosing one over another.

What are table functions (TVFs) in BigQuery, and how do they differ from views and scalar UDFs?

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Other

What are table functions (TVFs) in BigQuery, and how do they differ from views and scalar UDFs? ```hint Two axes Compare the three objects on two things: whether they accept arguments, and what shape they return (one value, or a set of rows and columns). ``` ### What a Strong Answer Covers - What a TVF is, how it is defined, and where it can be called in a query - How a TVF differs from a view in parameters and reuse - How a TVF differs from a scalar UDF in what it returns and where it can appear - Practical effects on cost and access, such as partition pruning, and when to pick each object ### Follow-up Questions - A dashboard queries a large date-partitioned table through a view and scans the whole table on every refresh. How could a TVF help, and what else could you change? - How would you let an analyst team query a filtered slice of a table without granting them access to the base table? - When would you choose a materialized view or a scheduled table over a TVF?

Overview: Asks what BigQuery table-valued functions are and how they compare with views and scalar user-defined functions. Tests understanding of parameterized SQL, where each object can be used in a query, and the cost and access-control effects of choosing one over another.

General logo
General
Nov 25, 2026
easyData ScientistOtherData Manipulation (SQL/Python)
0
0

What are table functions (TVFs) in BigQuery, and how do they differ from views and scalar UDFs?

What a Strong Answer Covers Guidance

  • What a TVF is, how it is defined, and where it can be called in a query
  • How a TVF differs from a view in parameters and reuse
  • How a TVF differs from a scalar UDF in what it returns and where it can appear
  • Practical effects on cost and access, such as partition pruning, and when to pick each object

Follow-up Questions Guidance

  • A dashboard queries a large date-partitioned table through a view and scans the whole table on every refresh. How could a TVF help, and what else could you change?
  • How would you let an analyst team query a filtered slice of a table without granting them access to the base table?
  • When would you choose a materialized view or a scheduled table over a TVF?