英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论