Troubleshooting skipped or failed dynamic table refreshes

本主题可帮助您解决刷新跳过或失败的问题。有关刷新缓慢的诊断,请参阅 监控动态表性能

监控动态表刷新情况时,请注意以下几点:

跳过刷新

动态表按时间表刷新。计划刷新开始时,以下情况可能会导致跳过刷新:

  • 如果正在刷新的动态表上游有另一个动态表,而上游的刷新失败或被跳过。

  • 如果动态表的上一个刷新仍在运行。

  • If the dynamic table's refresh often takes longer than the target lag or there's a significant difference between the target and actual lag, Snowflake might skip a refresh to reduce the rate of future skips.

    For instance, if a dynamic table has a 1-minute target lag but typically takes one hour to refresh, the system adjusts the "actual lag" accordingly.

    要提高刷新性能,请参阅 优化动态表性能

手动刷新永远不会跳过,但可能会导致跳过其他计划的刷新,特别是在对动态表执行频繁的手动刷新时。这样做会阻止下游动态表刷新。因此,如果某动态表具有根据目标延迟进行刷新的下游动态表,Snowflake 建议您避免频繁地对该动态表执行手动刷新。

Failed refreshes

Refresh failures are typically caused by issues with the dynamic table's query definition, input data (for example, parsing errors), or upstream failures.

Find failed refreshes

要查找失败的刷新,请查询刷新历史记录:

SELECT
  name,
  data_timestamp,
  state,
  state_code,
  state_message
FROM TABLE(INFORMATION_SCHEMA.DYNAMIC_TABLE_REFRESH_HISTORY(
  NAME_PREFIX => 'MY_DB.MY_SCHEMA',
  ERROR_ONLY => TRUE
));
Copy

You can also use the Refresh History page in Snowsight to view failed refreshes. The Source Data Timestamp column shows the time of the last successful refresh. A failed refresh doesn't advance this value. If it's far behind the target lag, your dynamic table is lagging.

Diagnose failed refreshes

Use the Query Profile to troubleshoot by selecting Show query profile next to each refresh. This shows the execution graph of the query.

在 Snowsight 中突出显示查询配置文件选项。

Use the Graph view in Snowsight to visualize dependencies. A failed or suspended upstream dynamic table causes its downstream tables to fail. For more information, see 查看连接到动态表的表图形.

查询事件表以查找故障

您可以查询事件表以查找动态表中的刷新失败:

SELECT
  timestamp,
  resource_attributes:"snow.executable.name"::VARCHAR AS dt_name,
  resource_attributes:"snow.query.id"::VARCHAR AS query_id,
  value:message::VARCHAR AS error
FROM my_event_table
WHERE
  resource_attributes:"snow.executable.type" = 'DYNAMIC_TABLE' AND
  resource_attributes:"snow.database.name" = 'MY_DB' AND
  value:state = 'FAILED'
ORDER BY timestamp DESC;
Copy

有关配置事件表和设置警报的更多信息,请参阅 动态表的事件表监控和警报

语言: 中文