本页面上的部分或全部信息可能不适用于 Trusted Cloud by S3NS。
使用更改历史记录
通过 BigQuery 更改历史记录,您可以跟踪 BigQuery 表的更改历史记录。您可以使用 GoogleSQL 函数查看指定时间范围内所做的特定类型的更改,以便处理对表所做的增量更改。了解对表进行了哪些更改可帮助您在 BigQuery 外部逐步维护表副本,同时避免费用高昂的副本。
所需权限
如需查看某个表的更改历史记录,您需要拥有该表的 bigquery.tables.getData
权限。以下预定义的 Identity and Access Management (IAM) 角色包含此权限:
roles/bigquery.dataViewer
roles/bigquery.dataEditor
roles/bigquery.dataOwner
roles/bigquery.admin
如果表具有或以前具有行级访问权限政策,则只有表管理员可以访问表的历史数据。表需要 bigquery.rowAccessPolicies.overrideTimeTravelRestrictions
权限,它包含在预定义的 roles/bigquery.admin
IAM 角色中。
如果表具有列级安全性,则您只能查看您有权访问的列的更改历史记录。
更改历史记录功能
您可以使用以下函数来了解表的更改历史记录:
价格和费用
调用更改历史记录函数会产生 BigQuery 计算费用。APPENDS
和 CHANGES
函数都需要处理在指定时间范围内写入表中的所有数据。此处理适用于所有写入操作,包括附加和变异操作。将表的 enable_change_history
选项设置为 FALSE
并不会减少 APPENDS
处理的数据量。
当您将表的 enable_change_history
选项设置为 TRUE
以使用 CHANGES
函数时,BigQuery 会存储表更改元数据。存储的这些元数据会产生额外的 BigQuery 存储费用和 BigQuery 计算费用。账单金额取决于对表所做的更改的数量和类型,通常很小。具有许多更改操作(尤其是大量删除操作)的表最有可能产生明显的费用。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-17。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-17。"],[[["\u003cp\u003eBigQuery change history allows tracking of modifications to BigQuery tables, enabling users to identify specific changes within a given timeframe.\u003c/p\u003e\n"],["\u003cp\u003eAccessing change history requires the \u003ccode\u003ebigquery.tables.getData\u003c/code\u003e permission, included in roles like \u003ccode\u003eroles/bigquery.dataViewer\u003c/code\u003e, \u003ccode\u003eroles/bigquery.dataEditor\u003c/code\u003e, \u003ccode\u003eroles/bigquery.dataOwner\u003c/code\u003e, and \u003ccode\u003eroles/bigquery.admin\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eAPPENDS\u003c/code\u003e function returns all rows appended to a table within a specified time range, while the \u003ccode\u003eCHANGES\u003c/code\u003e function, which requires enabling the \u003ccode\u003eenable_change_history\u003c/code\u003e option, returns all changed rows within a given range.\u003c/p\u003e\n"],["\u003cp\u003eUtilizing change history functions incurs BigQuery compute costs, as they must process all data written to the table during the designated time period, and setting \u003ccode\u003eenable_change_history\u003c/code\u003e to \u003ccode\u003eTRUE\u003c/code\u003e adds storage and compute costs.\u003c/p\u003e\n"],["\u003cp\u003eThis is currently a pre-GA feature and it is available "as is", therefore the support may be limited, and any questions or feedback about it should be directed to bq-change-history-feedback@google.com.\u003c/p\u003e\n"]]],[],null,[]]