0

In our snowflake, we have multiple users accessing the database. And sometimes when query takes long time people are cancelling the query from UI. I was wondering if there is a way to get information about who has cancelled the query. Like we have table QUERY_HISTORY to get information about the query.

Do we have a similar table to get information of query cancelled?

Ivan Kaloyanov
  • 1,748
  • 6
  • 18
  • 24
danD
  • 666
  • 1
  • 7
  • 29

2 Answers2

1

Only the user who executed the query can cancel it via the Abort button in the UI. Other ways to cancel a query would be to issue one of the following functions:

  • SYSTEM$CANCEL_QUERY
  • SYSTEM$CANCEL_ALL_QUERIES
  • SYSTEM$ABORT_SESSION
  • SYSTEM$ABORT_TRANSACTION
  • ALTER WAREHOUSE ... ABORT ALL QUERIES
  • ALTER USER ... ABORT ALL QUERIES

Any one of the above functions that are issued would be a query in the QUERY_HISTORY as well.

A cancelled query will have an error of 604, and I expect that the error code is different if the query has timed out (which by default is set to 2 days).

Chris
  • 680
  • 3
  • 6
0

The question is whether there is a table that stores cancelled queries like QUERY_HISTORY, I think. The answer is that even a cancelled query will be in QUERY_HISTORY.

Mike Walton
  • 6,595
  • 2
  • 11
  • 22