How does an open lakehouse table format let you query a table as it looked yesterday?
answer
- nothing was overwritten, so nothing was lost
- the write added, it did not replace
- the table is a versioned list of files
- read an older list, not an older backup
- one snapshot per commit, kept until expiry
basics
~20 sEvery write produces a new immutable snapshot: a record of the complete set of data files that form the table at that instant. Older snapshots are kept, so a time-travel query reads an older file list instead of the current one.
solid answer
~50 sA lakehouse table format keeps a **table layer** on top of the data files. Data files are never modified in place, so each write — append, update, delete, compaction — produces a **new snapshot**: an immutable record of exactly which files make up the table after that commit. The previous snapshots are not thrown away, they simply stop being the current one. Time travel is therefore cheap: the engine resolves the version or timestamp you asked for to a snapshot, reads that snapshot's file list, and plans a completely ordinary scan over it. You can address a past state either by version/snapshot id, which is stable, or by timestamp, which resolves to the newest snapshot committed at or before that moment. Nothing is copied and nothing is replayed — the old files were still sitting in storage the whole time. How far back you can go is bounded only by the table's snapshot retention policy.
code
sql · 10 lines-- read the table as it stood at a past moment
SELECT count(*) FROM sales TIMESTAMP AS OF '2026-08-20 00:00:00';
-- read one exact committed version
SELECT count(*) FROM sales VERSION AS OF 412;
-- what changed between two versions
SELECT * FROM sales VERSION AS OF 412
EXCEPT
SELECT * FROM sales VERSION AS OF 411;go deeper
Be ready to say in one breath that each write creates a new version of the file list and old files are left alone, so reading the past is just reading an older list. Know both AS OF forms.
Explain why immutability is the enabling property: no in-place edit means an old file list stays valid. Be able to describe what a snapshot contains and what an append, a delete and a compaction each produce.
Interviewers expect you to connect time travel to retention: it works until a cleanup job removes snapshots and their files, and that horizon is an operational choice you own.
Own the framing that history is a product feature with a storage bill — reproducibility, audit and rollback are bought by keeping files alive, and you decide per table how much of that to buy.
## The problem a snapshot solves Physically, a table on object storage is just a pile of files — usually Parquet or ORC — under some prefix. A bare directory of files has no notion of "the table as of yesterday": if a job overwrote or added files, the only state you can observe is whatever is in the directory right now. There is no version, no history, and no way to ask a question about the past. An open lakehouse table format adds a **table layer** above those files. Instead of "the table is whatever is in this directory," the rule becomes "the table is exactly the set of files that the current table metadata says it is." Once the file list is an explicit, written-down object, it can be versioned — and that is all a snapshot is. ## What a snapshot actually is A snapshot is an immutable record, produced by exactly one commit, of the complete set of data files that constitute the table at that instant, together with the schema and partitioning in effect and usually per-file statistics used for pruning. Three properties matter: - **It is a reference set, not a copy.** A snapshot holds pointers to files, so keeping a hundred snapshots costs metadata, not a hundred copies of the data. - **Data files are immutable.** A file referenced by snapshot 41 is byte-identical forever; nothing rewrites it in place. That is precisely why an old snapshot stays readable — its files were never disturbed. - **Each commit produces exactly one new snapshot.** Snapshots form a lineage, and the table has one *current* snapshot at any moment. ## How each kind of write produces a new snapshot An **append** yields a snapshot whose file set is the old set plus the newly written files. A **delete or update** cannot edit a file, so the format either rewrites the affected files and produces a snapshot referencing the replacements instead of the originals (copy-on-write), or keeps the originals and adds delete markers that readers apply on the fly (merge-on-read). A **compaction** produces a snapshot referencing a few large files instead of many small ones, with identical logical contents. In every case the previous snapshot is untouched and still points at files that still exist. ## Reading an old snapshot Time travel has two addressing modes: ```sql -- as of a wall-clock moment SELECT count(*) FROM sales TIMESTAMP AS OF '2026-08-20 00:00:00'; -- as of a specific committed version SELECT count(*) FROM sales VERSION AS OF 412; ``` Timestamp addressing resolves to the newest snapshot committed at or before the timestamp, so the same timestamp keeps resolving to the same snapshot but *nearby* timestamps drift as new commits land. Version addressing is exact and stable, which is what you want when you record which data an experiment or a report used. Execution is unremarkable: the engine gets a file list from the chosen snapshot and scans it. A time-travel query costs about what the same query costs on the current table. ## What it is good for Debugging a pipeline ("what did this table look like before the bad run?"), reproducing an ML training set or a regulatory report exactly, diffing two versions to see what a job changed, auditing, and — the payoff most interviews want — rolling the table back to a known-good version with one command rather than restoring from a backup. ## What it is not Time travel gives you **table states**, not a row-level change history: you can compare version 411 and 412 yourself, but a per-row change feed is a separate opt-in feature where a format offers one. It is also not a backup — the old snapshot points at files in the same bucket, so anything that destroys those objects destroys the history too. And it is bounded: retention policies expire old snapshots and delete files that no surviving snapshot references, which is what makes the space reclaimable in the first place. Past the retention horizon, an AS OF query simply fails. ## The junior-level takeaway Immutable files plus a versioned list of them equals history for free. You are not paying for a copy of yesterday's table; you are paying to *not delete* yesterday's files yet.
- What is the difference between time travelling by timestamp and by version?A version or snapshot id names one exact commit and never moves, which is what you want for reproducibility and for recording what a report read. A timestamp resolves to the newest snapshot committed at or before that instant, so it is convenient for "yesterday at midnight" but the resolved snapshot depends on what has been committed since.
- Does keeping many snapshots duplicate the data?No. A snapshot stores references to files, and unchanged files are shared across every snapshot that includes them. The real cost is that files an old snapshot still references cannot be deleted, so after heavy updates or compaction the storage footprint is larger than the live data until those snapshots expire.
- Can you time travel to any point in time you like?Only to committed snapshots, and only within the retention window. There is no state between two commits — the table jumps from version to version — and once a maintenance job expires old snapshots, anything before the retention horizon is gone.
Like a photo album of receipts rather than a photocopier: each commit files a new page listing which receipts are currently valid, and old pages still list receipts that are still in the drawer.
saying these in an interview costs you the question
- Says time travel restores the table from a backup copy
- Claims every past row value is queryable, not past table states
- Assumes old versions are kept forever at no cost
- Thinks a plain directory of Parquet files supports AS OF queries
- Says time travel re-runs the pipeline to rebuild the old state