Search Optimization Service (SOS) is a serverless feature that dramatically accelerates point lookup queries against large Snowflake tables. It builds an auxiliary data structure called the Search Access Path internally, narrowing down scan targets with a precision that partition pruning alone cannot reach. It is available on Enterprise Edition or higher.
During normal query execution, Snowflake prunes by consulting micro-partition metadata (column min/max values). On top of that, SOS builds a Search Access Path that records the mapping between column values and micro-partitions. When you search for a specific value in a WHERE clause, the access path pinpoints exactly the matching micro-partitions, cutting scan volume by orders of magnitude.
The SQL syntax differs depending on whether you apply SOS to the entire table or limit it to specific columns and methods.
-- Enable SOS for the entire table
ALTER TABLE analytics.customers
ADD SEARCH OPTIMIZATION;
-- Enable SOS on specific columns with a chosen method
ALTER TABLE analytics.customers
ADD SEARCH OPTIMIZATION ON
EQUALITY(customer_id),
EQUALITY(email),
SUBSTRING(customer_name),
EQUALITY(metadata:plan_type);
-- Disable SOS on a specific column
ALTER TABLE analytics.customers
DROP SEARCH OPTIMIZATION ON
SUBSTRING(customer_name);
-- Disable SOS on the entire table
ALTER TABLE analytics.customers
DROP SEARCH OPTIMIZATION;
-- Check SOS status
DESCRIBE SEARCH OPTIMIZATION ON analytics.customers;The query patterns SOS can accelerate are limited. The table below also covers exam-tested points, so make sure you have it down precisely.
| Query Pattern | Method | Example SQL | Notes |
|---|---|---|---|
| Equality (=) | EQUALITY | WHERE id = 12345 | Ideal for primary key lookups |
| IN clause | EQUALITY | WHERE status IN ('A','B') | Multi-value lookups |
| Substring search | SUBSTRING | WHERE name LIKE '%tanaka%' | Includes prefix matches |
| VARIANT / OBJECT path search | EQUALITY | WHERE data:key = 'val' | Supports semi-structured data |
| GEOGRAPHY / GEOMETRY functions | GEO | ST_DISTANCE(geo, ...) < 1000 | Geospatial search |
| Range search (BETWEEN / >=) | - | WHERE date BETWEEN '...' AND '...' | Not supported by SOS (use Clustering Keys) |
SOS and Clustering Keys are not competing features — they are complementary.
| Criterion | Search Optimization Service | Clustering Keys |
|---|---|---|
| Best-fit queries | Equality / IN / substring / VARIANT search | Range filters (BETWEEN / >= / <=) |
| Internal structure | Search Access Path (auxiliary index-like structure) | Physical sorting of micro-partitions |
| Maintenance | Serverless Credits (automatic) | Automatic Clustering (Serverless Credits) |
| Edition requirement | Enterprise or higher | Enterprise or higher |
| Column specification | ON clause specifies columns and methods individually | CLUSTER BY clause, up to about 4 columns |
| Combined use | Can be combined. A typical pattern is Clustering Key on a date column with SOS on an ID column. | |
SOS maintenance cost is proportional to DML frequency. Tables with high-frequency INSERTs see costs balloon, so periodic monitoring is essential.
-- Review SOS maintenance cost history
SELECT *
FROM TABLE(INFORMATION_SCHEMA.SEARCH_OPTIMIZATION_HISTORY(
DATE_RANGE_START => DATEADD('DAY', -14, CURRENT_TIMESTAMP()),
DATE_RANGE_END => CURRENT_TIMESTAMP()
));
-- Aggregate cost by table from ACCOUNT_USAGE
SELECT
TABLE_NAME,
SUM(CREDITS_USED) AS total_credits,
COUNT(*) AS maintenance_runs
FROM SNOWFLAKE.ACCOUNT_USAGE.SEARCH_OPTIMIZATION_HISTORY
WHERE START_TIME >= DATEADD('DAY', -30, CURRENT_TIMESTAMP())
GROUP BY TABLE_NAME
ORDER BY total_credits DESC;Here are typical design patterns for adopting SOS in production.
SnowPro
問題 1
You need to run frequent equality searches by transaction_id (a UUID) against a multi-billion-row transaction table. Which approach best optimizes performance?
正解: B
SOS is the best fit for point lookups on columns with extremely high cardinality such as UUIDs. Clustering Keys give little benefit on very high-cardinality columns and rarely justify the maintenance cost. Unique constraints are not a search-acceleration feature, and scaling up the warehouse does not reduce the total amount of data being scanned.
How do you decide between Search Optimization Service and Clustering Keys?
Clustering Keys control the physical layout of data to improve partition pruning, and they work well for range filters (BETWEEN / >= / <=) and equality filters. SOS, on the other hand, builds an auxiliary access structure specialized for equality search (= / IN), substring search (LIKE '%keyword%'), VARIANT path search, and GEOGRAPHY/GEOMETRY functions. The two can be combined, and the basic design pattern is to add SOS for the search patterns that Clustering Keys cannot cover.
Does enabling SOS increase storage costs?
Yes. SOS internally builds a data structure called the Search Access Path, which incurs additional storage cost. Every DML statement also triggers maintenance of the access path, billed as Serverless Credits. You can track maintenance cost trends with the SEARCH_OPTIMIZATION_HISTORY table function.
Can SOS be applied to only specific columns?
Yes. The ALTER TABLE ADD SEARCH OPTIMIZATION ON clause lets you specify target columns and methods (EQUALITY / SUBSTRING / GEO) individually. Omitting the ON clause applies SOS to the entire table, but applying it to unused columns drives up maintenance cost, so the recommended practice is to target only columns that are actually used in queries.
Practice with certification-focused question sets
無料で問題を解いてみるNicheeLab Editorial Team
NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.
Snowflake Certifications: All 11 Exams Explained (2026)
Every SnowPro certification — Associate, Core, Specialty, Ad...
Snowflake Exam Difficulty Ranking: All 11 Certs Compared (2026)
All 11 SnowPro exams ranked by difficulty with study-time es...
Snowflake Study Guide: Fastest Pass Route by Exam (2026)
How to pass SnowPro certifications efficiently — official ma...
SnowPro Core (COF-C03): Complete Exam Guide (2026)
Pass the SnowPro Core exam — six domains, scope, sample ques...
SnowPro Associate Platform (SOL-C01): Complete Guide (2026)
The entry-level SnowPro Associate exam — scope, weighting, s...