暂停或恢复动态表

本主题讨论动态表自动暂停的原因以及如何手动暂停或恢复动态表。

Suspended dynamic tables aren’t automatically refreshed; you can manually refresh them.

自动动态表暂停

动态表将在连续 5 次计划刷新错误后自动暂停。成功刷新(包括手动刷新)会将错误计数重置为 0。例如,如果表连续两次计划刷新失败,然后在下一次刷新中成功,则错误计数将重置为 0。

手动触发的刷新产生的错误不计入此限制。

任何依赖于已暂停表的动态表也将被暂停。

您可以使用以下选项之一查看动态表的当前状态(ACTIVE 或 SUSPENDED):

Execute the DYNAMIC_TABLE_GRAPH_HISTORY table function:

SELECT name, scheduling_state
  FROM TABLE (INFORMATION_SCHEMA.DYNAMIC_TABLE_GRAPH_HISTORY());

In the output, the SCHEDULING_STATE column shows the state of your dynamic table (ACTIVE or SUSPENDED):

+-------------------+---------------------------------------------------------------------------------+
  | NAME              | SCHEDULING_STATE                                                                |
  |-------------------+---------------------------------------------------------------------------------|
  | DTSIMPLE          | {                                                                               |
  |                   |   "reason_code": "SUSPENDED_DUE_TO_ERRORS",                                     |
  |                   |   "reason_message": "The DT was suspended due to 5 consecutive refresh errors", |
  |                   |   "state": "SUSPENDED",                                                         |
  |                   |   "suspended_on": "2023-06-06 19:27:29.142 -0700"                               |
  |                   | }                                                                               |
  | DT_TEST           | {                                                                               |
  |                   |   "state": "ACTIVE"                                                             |
  |                   | }                                                                               |
  +-------------------+---------------------------------------------------------------------------------+

手动暂停动态表

当您暂时不需要某个动态表时,可以手动将其暂停,以避免产生刷新成本。不必将其删除,可保留以供将来使用。暂停操作还可以帮助您更好地控制刷新频率,例如,当发生跳过操作时,您可能需要一些时间进行故障排除。

如果您希望确保在特定时间或特定事件发生时进行刷新,可以使用任务或定期运行的脚本来执行手动刷新,因为动态表无法保证精确的刷新时间。这样,您可以精确控制表的刷新。

您可以使用 ALTER DYNAMIC TABLE … SUSPEND 命令或 Snowsight 手动暂停动态表,但存在以下限制:

  • Suspending a dynamic table also suspends the dynamic tables that are downstream from it.
  • Suspending a dynamic table with incremental refresh beyond the Time Travel retention period of its base tables will cause it to fail on the next refresh after the dynamic table resumes.
ALTER DYNAMIC TABLE my_dynamic_table SUSPEND;

恢复动态表

To resume your dynamic tables, use either the ALTER DYNAMIC TABLE … RESUME command or Snowsight.

ALTER DYNAMIC TABLE my_dynamic_table RESUME;