From TASK_HISTORY & QUERY_HISTORY,I can see details of the queries executed by a scheduled TASK. But When I look them up in Snowsight, query couldn't be found. I am curious to see Profile of the query executed by the TASK.
Otherwise is there any alternate way to compare/troubleshoot query execution/plan via sql in Snowflake?
Can you please make sure you have enabled "Queries executed by user tasks" option in snowsight to view the SQL statements executed or stored procedures called by user tasks.
Please review the below documentation for more information:
https://docs.snowflake.com/en/user-guide/ui-history#overview-of-features
https://docs.snowflake.com/en/user-guide/ui-snowsight-activity#filter-query-history
You can also use the GET_QUERY_OPERATOR_STATS that returns statistics about individual query operators within a query that has completed.
Please review the below documentation for more information:
https://docs.snowflake.com/en/sql-reference/functions/get_query_operator_stats