Snapshots and Time Travel
Scheduled Hypertables are stored in Z-Lake and feature snapshots. A snapshot is a point-in-time representation of a table's data and metadata. It captures a consistent view of the table's contents, including all updates, deletions, and additions made since the last snapshot. When a new snapshot is created, only the changed data is written to the storage layer, allowing for efficient incremental updates. This incremental snapshotting approach also enables fast, low-cost data restoration in the event of a failure or accidental data loss.
Time travel
The platform provides the ability to query historical data. This means that we can query the table as it was when a previous snapshot was taken. Even data that has since been modified or deleted will be available.
Historical data of the table can be selected by specifying the snapshot id of the version of the table that needs to be retrieved:
SELECT
*
FROM
hypertables.scheduled.sales FOR VERSION AS OF 36362383848346846778
Another way of retrieving historical data is to specify a point in time in the past. For example a week or year ago. The latest snapshot of the table taken before or at the specified time in the SQL query is used for providing the previous state of the table:
SELECT
*
FROM
hypertables.scheduled.sales FOR TIMESTAMP AS OF TIMESTAMP '2023-04-05 21:23:47.001 Asia/Kolkata'