QuestionQ38

Design and Manage Snowflake Resources and Performance

Which query displays a list of the 20 latest executions of a specified task, MYTASK, that were scheduled during the last hour and have either completed or are still running?

Explanation

In Snowflake INFORMATION_SCHEMA.TASK_HISTORY, SCHEDULED_TIME_RANGE_START restricts executions by their scheduled time, RESULT_LIMIT => 20 returns at most the 20 most recent matching entries, and TASK_NAME=>'MYTASK' selects the named task. QUERY_ID is populated only after a task starts, so WHERE query_id IS NOT NULL excludes future scheduled executions while retaining executions that are completed or currently running.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!