How does table and partition expiration work in BigQuery, and why would you configure it?

Quick Overview

Asks how BigQuery table expiration and partition expiration delete data automatically, and when to configure each one. It tests the dataset, table and partition levels, how partition age is measured, and the cost, retention and accidental data loss trade-offs.

How does table and partition expiration work in BigQuery, and why would you configure it?

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Other

How does table and partition expiration work in BigQuery, and why would you configure it? ```hint Compare the scopes Think about what gets deleted in each case (a whole table or one slice of it) and what each setting measures age from. ``` ### What a Strong Answer Covers - The levels where expiration can be set (dataset default, table, partition) and what each one deletes - How the age of a partition is measured - How defaults and changed settings apply to tables and partitions that already exist - Reasons to configure it: storage cost, retention policy, cleanup of scratch data - Risks such as unexpected deletion when a setting changes or when old data is backfilled ### Follow-up Questions - What happens to existing partitions when you lower `partition_expiration_days` on a live table? - You backfill two years of history into a table with a 90-day partition expiration. What happens to the loaded data? - When would you use table expiration instead of partition expiration? - A regulation requires deleting a user's data within 30 days of a request. Is partition expiration enough on its own?

Overview: Asks how BigQuery table expiration and partition expiration delete data automatically, and when to configure each one. It tests the dataset, table and partition levels, how partition age is measured, and the cost, retention and accidental data loss trade-offs.

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

How does table and partition expiration work in BigQuery, and why would you configure it?

What a Strong Answer Covers Guidance

  • The levels where expiration can be set (dataset default, table, partition) and what each one deletes
  • How the age of a partition is measured
  • How defaults and changed settings apply to tables and partitions that already exist
  • Reasons to configure it: storage cost, retention policy, cleanup of scratch data
  • Risks such as unexpected deletion when a setting changes or when old data is backfilled

Follow-up Questions Guidance

  • What happens to existing partitions when you lower partition_expiration_days on a live table?
  • You backfill two years of history into a table with a 90-day partition expiration. What happens to the loaded data?
  • When would you use table expiration instead of partition expiration?
  • A regulation requires deleting a user's data within 30 days of a request. Is partition expiration enough on its own?