page55
36
Flow Control
Two types of flow control model exist.
•
Pull-based: The consumer continually polls for messages at the
publisher.
•
Push-based: The publisher pushes messages to the consumer as
they become available.
The Snowflake query execution engine implements push-based flow control. As
soon as results are available, they are pushed to consumers and further processed in a
pipelined manner.
Note that after statement execution, summary information for it is available in
snowflake.account_usage.query_history
with a maximum latency of 45 minutes and
visible for a year.
The performance profile provides more informative details and is retained for only
two weeks, so analysis of long-running statements should be completed within this
time to focus on optimization efforts, which assist with quicker execution and reduce
Snowflake billing.
Summary
Snowflake implements a cost-based approach to delivering their query optimizer,
which has many steps in common with other RDBMS vendors. Every RDBMS vendor
implements bespoke optimizations, and Snowflake is no exception where these
optimizations focus on satisfying edge cases and analytic specific features.
With a tight focus on delivering a robust optimizer that delivers stable execution
plans, Snowflake deliberately removes levers and switches to influence system behavior
and instead relies upon the built-in core query optimizer capability to handle as much as
possible.
In this chapter I explained at a summary level the steps taken, from submitting a
query through getting the corresponding result set. You then looked into the processing
steps required to plan and optimize your query before execution.
Chapter 2
the Query Optimizer