有没有办法获取已取消查询的信息

huangapple go评论64阅读模式
英文:

Is there a way to get the information about cancelled query

问题

我们的Snowflake中,有多个用户访问数据库。有时候,当查询需要很长时间时,人们会从用户界面取消查询。我想知道是否有一种方法可以获取有关谁取消了查询的信息。就像我们有一个查询历史表(QUERY_HISTORY)来获取有关查询的信息一样。我们是否有一个类似的表来获取取消查询的信息?

英文:

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?

答案1

得分: 1

只有执行查询的用户可以通过UI中的“中止”按钮来取消它。取消查询的其他方式包括执行以下函数之一:

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

上述任何一个函数的执行都会在QUERY_HISTORY中生成一条查询记录。

取消的查询会显示错误代码604,如果查询已超时(默认为2天),我预期错误代码会不同。

英文:

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).

答案2

得分: 0

问题是是否有一个存储取消查询的表,类似于QUERY_HISTORY,我认为。答案是即使查询被取消,它也会出现在QUERY_HISTORY中。

英文:

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.

huangapple
  • 本文由 发表于 2020年1月4日 00:31:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/59582054.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定