page285
373
The general form of
GET_QUERY_OPERATOR_STATS
is as follows:
SELECT <attributes>
FROM TABLE ( get_query_operator_stats(<your value here>))
WHERE <predicates>
ORDER BY <ordering>;
GET_QUERY_OPERATOR_STATS
accepts a single value, which must be one of the
following:
•
The value returned by
last_query_id()
•
A session variable containing a valid
query_id
•
A string literal set to valid
query_id
You might also use
GET_QUERY_OPERATOR_STATS
to investigate the most recently
executed SQL statement:
SELECT *
FROM TABLE ( get_query_operator_stats(last_query_id()));
Refer to Chapter 4 for further information on using
GET_QUERY_OPERATOR_STATS
. You
can find more information about common query problems identified by
GET_QUERY_
OPERATOR_STATS
at
https://docs.snowflake.com/en/user-guide/ui-snowsight-
activity#common-query-problems-identified-by-query-profile
.
Optimizing Code
In this section, you will consider how to optimize your code to match Snowflake’s “best
practices” to optimize both costs and query performance. Some of the identified actions
are zero risk and immediate benefits; others are more invasive.
You are responsible for ensuring the quality of your submitted SQL statements.
Keep it Simple, Stupid.
ChapTer 10
OpTimizing perfOrmanCe