page47
28
Figure 2-1 is just an overview; a more comprehensive explanation is provided
shortly.
Naturally, queries may fail to execute for a variety of reasons, some of which I briefly
discuss next.
Query Failure
Queries may fail to process for a variety of reasons. I cannot list all possible query
execution failures though they largely fall into two categories: Queries that fail due to
not passing through the query optimizer processing through to execution, and queries
that successfully begin execution but subsequently fail due to infrastructure capacity or
interconnectivity failure.
An example of infrastructure failure could be an occasional warehouse failure where
Snowflake automatically recovers to complete the query execution transparently noting
the result set may be slightly delayed while detection and recovery occurs.
The quality of our SQL statements can also lead to execution failure. As an example,
a missing join condition often results in a Cartesian product (also known as a cross-join)
where unexpectedly large result sets are generated resulting in spills or out-of-memory
warehouse failures.
in my 30+ years of experience across a variety of rDBmS platforms, it’s usually my
code that is at fault.
Some examples of why queries may fail to execute include the following:
•
Invalid syntax
•
Inaccessible object
•
Out of memory
•
Client process failure
•
Network or interconnect failure
•
Warehouse failure
•
Other unspecified reason
Chapter 2
the Query Optimizer