[null,null,["上次更新時間:2025-08-16 (世界標準時間)。"],[],[],null,["\u003cbr /\u003e\n\nPoint-in-time recovery (PITR) protects against\naccidental deletion or writes. PITR maintains versions of your\ndocuments from past timestamps. For example, in the case of a developer\npushing any incorrect data, accidental deletes or writes, PITR can recover the\ndata to a point in time in the past (up to a maximum of 7 days).\nFor any live database that follows [Best practices](./best-practices), use of PITR doesn't affect the performance of reads or writes.\n\nPITR window\n\nAfter you enable PITR, Cloud Firestore starts retaining PITR data. PITR data\nis retained for 7 days in the PITR window.\n\nYou can read data for a timestamp based on when PITR was enabled:\n\n| PITR enablement status | Earliest PITR data available | |\n|------------------------------|----------------------------------------|---|\n| Disabled | 1 hour before the time of read request | |\n| enabled within 7 days | 1 hour before PITR was enabled | |\n| enabled more than 7 days ago | 7 days before the time of read request | |\n\n| **Note:** You can't start reading from 7 days in the past immediately after you enable PITR.\n\nA single version per minute is retained in the PITR window. You can read\ndocuments at minute granularity using a whole minute timestamp. Reads that are\nnot at minute granularity like `2023-05-30 09:00:00.1234AM` return an\nerror that the `read_time` is too old.\n\nOnly one version of a document is retained in case of multiple writes. For\nexample, if a document had multiple writes ranging from `v1, v2, ... vk` between\n`2023-05-30 09:00:00AM` (exclusive) and `2023-05-30 09:01:00AM` (inclusive)\ntimestamp, a read request at timestamp `2023-05-30 09:01:00AM` returns the `vk`\nversion of the document.\n\nYou can read from the data created during the PITR\nwindow. The data is stored at a minute granularity and you can recover data\nat the same granularity. The PITR feature is disabled by default.\n\nThe [`earliestVersionTime`](https://cloud.google.com/firestore/docs/reference/rest/v1/projects.databases#Database) field of your database specifies the\nearliest permissible read time for your data.\n\nRegardless of whether PITR is enabled or not, you can read (but not export) documents at any microsecond-granularity timestamp within the past hour, but not before the `earliestVersionTime`.\n\nWays to recover data\n\nThere are several ways to recover data:\n\n- To **recover a portion of the database** ,\n\n perform a [stale read](/docs/firestore/understand-reads-writes-scale#stale_reads)\n specifying a query-condition or using direct key lookup along with a timestamp in\n the past,\n\n and then write the results back into the live database. This is\n typically used for surgical operations on a live database. For example, if\n you accidentally delete a particular document or incorrectly update a\n subset of data, you can recover it with this method. For instructions, see\n [recovering a portion of your database](/docs/firestore/use-pitr#read-pitr).\n\n- To **recover the entire database** , [export](/docs/firestore/use-pitr#export-import) the database specifying\n a timestamp in the past and then import it to a new database. The PITR\n export operation supports all filters, including export of all documents and\n export of specific collections. You can export PITR data where the timestamp\n is a whole minute timestamp within the past seven days, but not earlier than\n the `earliestVersionTime`. You can also\n\n [clone the database](/docs/firestore/create-databases#clone-database)\n\n to create a copy of the database at a specific timestamp.\n\nPricing\n\nConsider the following pricing information before you enable PITR for your database:\n\n- Storage: Cloud Firestore measures the database size daily. Over the\n period of a month, these sample points are averaged to calculate the\n database storage size. This average value is multiplied by the unit price of\n PITR (GB-month). See [storage pricing](/docs/firestore/pricing) for more information.\n\n PITR storage doesn't have a free tier and you must have billing enabled if you want to use PITR.\n- Compute billing: Any queries that you make during the PITR window of 7 days,\n either through stale reads or exports, incur read operation costs\n based on the number of documents read. See [pricing](/docs/firestore/pricing) for more\n information.\n\n- Minimum billing: You may be charged up to 1 day of PITR storage cost even if you disable PITR within a day after enablement.\n\nWhat's next\n\n- Learn more about how to [recover data with PITR](./use-pitr)."]]