Query Acceleration, Search Optimization, Clustering
SnowPro Core · Lesson 21 of 27 · 2:37:50
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the SnowPro Core Certification exam (COF-C03). In this lesson: the query acceleration service, search optimization, materialized views, clustering keys, and choosing the right tool. Follows Foxglove Apparel, a fictional online clothing retailer. Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Three slow patterns
Foxglove has three slow patterns: an occasional analyst query that scans the whole orders table, a support screen that looks up one shipment by its tracking number, and a dashboard that recomputes the same sales totals all day. A bigger warehouse would help each of them a little, at a high price. Snowflake has a better tool for each one, and choosing the right tool is what the exam checks.
The query acceleration service
The query acceleration service, an Enterprise Edition feature, reduces the impact of outlier queries, which use far more resources than the typical query on a warehouse. It offloads portions of their work, such as scanning and filtering, to shared compute resources that run in parallel. It helps two patterns: large scans with a selective filter or an aggregation, and statements that insert or copy large amounts of data. You enable it per warehouse, and Snowflake turns it on by default for Gen2 standard warehouses and for multi-cluster warehouses.
Eligibility and scale factor
The QUERY_ACCELERATION_ELIGIBLE view lists past queries, and warehouses, that would have benefited, and SYSTEM$ESTIMATE_QUERY_ACCELERATION checks a single query. The scale factor caps the compute a warehouse can lease, as a multiple of its own size, with a default of eight. A scale factor of zero removes the upper limit. The service is charged like other serverless features, by the second, so gains and costs depend on the workload.
Search optimization
The search optimization service, also an Enterprise Edition feature, speeds up selective lookups that return one or a few rows from a large table. It builds and maintains a search access path, which records the values that may be found in each micro-partition, so most partitions are skipped. It supports equality and IN predicates, substring and regular expression searches, text searches, semi-structured elements, and geospatial functions. You can enable it for the whole table, or for chosen columns and methods, and a serverless maintenance service keeps it current, at a cost in storage and compute.
When search optimization helps
It works best when a query runs for a few seconds or longer, and filters on a column with roughly a hundred thousand distinct values or more. It helps most on columns other than the clustering key, which pruning already serves. External tables, hybrid tables, and temporary tables are not supported. And queries are not accelerated until the access path is fully built, which SHOW TABLES reports.
Materialized views
A materialized view stores the precomputed results of a query, and it also requires Enterprise Edition. A background service maintains it as the base table changes, and queries always get current data, even when maintenance has fallen behind. The optimizer can rewrite a query on the base table to use the materialized view, and you can give the view its own clustering key. It can query only a single table, with no joins, no window functions, no HAVING clause, and no ORDER BY clause.
Choosing the right tool
Materialized views pay off when the results are small compared with the base table, costly to compute, read often, and the base table changes rarely. For joins, or a refresh on a target lag, use a dynamic table instead. A clustering key serves range filters and pruning on a very large table, while search optimization serves selective lookups on other columns. And the query acceleration service absorbs the occasional outlier, on the warehouse where it runs.
Recap
Let's recap. The query acceleration service offloads parts of outlier queries, and its scale factor caps the cost. Search optimization builds an access path for selective lookups on columns with many distinct values. Materialized views store small, costly results from a single table, and Snowflake keeps them current. A clustering key serves range filters on very large tables. And query acceleration, search optimization, and materialized views all require Enterprise Edition.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
On Foxglove’s reporting warehouse, a few ad hoc queries scan the whole orders table with a selective filter and run far longer than everything else. Enterprise Edition. What speeds up these outliers without resizing the warehouse?
- Raise the warehouse’s maximum clusters
- Enable the query acceleration service
- Create a materialized view on orders
- Lower the statement timeout
Show the answer
Enable the query acceleration service
Query acceleration offloads the scanning and filtering of these outliers to shared compute. “Raise the warehouse’s maximum clusters” serves more concurrent queries, but each query still runs on one cluster of the same size. “Create a materialized view on orders” suits a repeated query pattern, not ad hoc queries that change every time. And “Lower the statement timeout” would cancel the long queries, without making them faster.
Support looks up one shipment at a time by its tracking number, in a table of billions of rows clustered by ship date for the daily reports. Each lookup scans most partitions. What is the best fit?
- Run the lookups on a larger warehouse
- Cluster the table by tracking number
- Add search optimization on tracking number
- Create a materialized view of shipments
Show the answer
Add search optimization on tracking number
Search optimization on equality for the tracking number lets each lookup skip almost every partition. “Run the lookups on a larger warehouse” would scan the same partitions, only faster, at a higher cost. “Cluster the table by tracking number” would break the pruning that the daily reports rely on. And “Create a materialized view of shipments” would hold as many rows as the table, so each lookup would still scan everything.
Foxglove’s dashboards total sales by day and region, with different filters each time, from a large table loaded once a day. The totals are small, the aggregation costly. Which option fits best?
- A materialized view of daily totals
- Search optimization on the region
- The query acceleration service
- A secure view over the sales table
Show the answer
A materialized view of daily totals
A materialized view keeps the small, costly totals ready, and it stays current after each daily load. “Search optimization on the region” speeds up selective lookups, not a full aggregation. “The query acceleration service” would still aggregate the whole table on every query. And “A secure view over the sales table” stores nothing, so the aggregation runs every time.