Hybrid Tables are the centerpiece of Snowflake's Unistore architecture, a table type that delivers low-latency row-level operations (OLTP) and large-scale analytical queries (OLAP) on the same table. A PRIMARY KEY is mandatory, and the combination of row-oriented storage and indexes lets single-row lookups and point updates complete in milliseconds.
通常テーブル (Standard Table)
└─ 列指向マイクロパーティション
└─ 大規模スキャン・集計に最適化
└─ 単一行ルックアップは非効率
Hybrid Table
├─ 行指向ストレージ(主キーインデックス付き)
│ └─ 単一行 SELECT / UPDATE / DELETE がミリ秒で完了
│ └─ 参照整合性制約(FOREIGN KEY)をサポート
│
└─ 列指向ストレージ(バックグラウンド同期)
└─ SELECT * / 集計クエリはこちらから読み取り
└─ Snowflakeが自動的に行→列の同期を実行-- 基本的なHybrid Table(主キー必須)
CREATE OR REPLACE HYBRID TABLE app_db.public.users (
user_id INT PRIMARY KEY,
email VARCHAR(255) NOT NULL UNIQUE,
display_name VARCHAR(100),
status VARCHAR(20) DEFAULT 'active',
created_at TIMESTAMP_NTZ DEFAULT CURRENT_TIMESTAMP(),
last_login TIMESTAMP_NTZ,
metadata VARIANT
);
-- 複合主キーのHybrid Table
CREATE OR REPLACE HYBRID TABLE app_db.public.user_sessions (
user_id INT,
session_id VARCHAR(64),
started_at TIMESTAMP_NTZ DEFAULT CURRENT_TIMESTAMP(),
expires_at TIMESTAMP_NTZ,
ip_address VARCHAR(45),
user_agent VARCHAR(500),
PRIMARY KEY (user_id, session_id),
FOREIGN KEY (user_id) REFERENCES app_db.public.users(user_id)
);
-- セカンダリインデックスの追加
CREATE INDEX idx_users_email ON app_db.public.users (email);
CREATE INDEX idx_sessions_expires ON app_db.public.user_sessions (expires_at);| Aspect | Recommended | Avoid |
|---|---|---|
| Data type | INT, BIGINT, VARCHAR (short fixed length) | VARCHAR (long variable length), VARIANT |
| Cardinality | High-cardinality values (UUID, sequence) | Low-cardinality columns (status, region) |
| Number of columns | Composite keys of 1-3 columns | Composite keys of 4+ columns (index size grows) |
| Immutability | Columns whose values do not change | Frequently updated columns |
-- 単一行の挿入(低レイテンシ)
INSERT INTO app_db.public.users (user_id, email, display_name)
VALUES (1001, '[email protected]', 'Alice');
-- 主キーによるポイント更新(ミリ秒レベル)
UPDATE app_db.public.users
SET last_login = CURRENT_TIMESTAMP(), status = 'active'
WHERE user_id = 1001;
-- 主キーによる単一行削除
DELETE FROM app_db.public.users WHERE user_id = 1001;
-- MERGE(upsert): アプリケーション側のidempotency確保
MERGE INTO app_db.public.users t
USING (SELECT 1001 AS user_id, '[email protected]' AS email, 'Alice' AS name) s
ON t.user_id = s.user_id
WHEN MATCHED THEN UPDATE SET t.last_login = CURRENT_TIMESTAMP()
WHEN NOT MATCHED THEN INSERT (user_id, email, display_name) VALUES (s.user_id, s.email, s.name);
-- 分析クエリ(OLAP)も同一テーブルで実行可能
SELECT
DATE_TRUNC('DAY', created_at) AS signup_date,
COUNT(*) AS new_users,
COUNT_IF(status = 'active') AS active_users
FROM app_db.public.users
GROUP BY signup_date
ORDER BY signup_date DESC;Hybrid Tables include a row-level locking mechanism. Standard Snowflake tables handle concurrency via snapshot isolation (MVCC) at the micro-partition level, but Hybrid Tables take pessimistic locks at the row level and serialize concurrent updates to the same row.
-- FOREIGN KEY制約(Hybrid Tables間でのみ有効)
CREATE OR REPLACE HYBRID TABLE app_db.public.orders (
order_id INT PRIMARY KEY AUTOINCREMENT,
user_id INT NOT NULL,
total_amount NUMBER(12,2) NOT NULL,
order_status VARCHAR(20) DEFAULT 'pending',
created_at TIMESTAMP_NTZ DEFAULT CURRENT_TIMESTAMP(),
FOREIGN KEY (user_id) REFERENCES app_db.public.users(user_id)
);
-- NOT NULL, UNIQUE, DEFAULT 制約もサポート
-- ただしCHECK制約は未サポート| Characteristic | Standard Table | Hybrid Table |
|---|---|---|
| Storage format | Columnar (micro-partitions) | Row-oriented + columnar (background sync) |
| Primary key | Optional (constraint only, not enforced) | Mandatory (enforced as an index) |
| FOREIGN KEY | Syntactically supported but not enforced | Referential integrity is actually enforced |
| Indexes | None | Primary key index + secondary indexes |
| Single-row lookup | Full scan or pruning | Millisecond-level response via indexes |
| Concurrency control | MVCC (snapshot isolation) | Row-level locking |
| Clustering Keys | Supported | Not supported |
| Time Travel | Supported | Limited |
Data Architecture
問題 1
You want to build a web application's user session management table in Snowflake. You need low-latency single-row lookups by user_id, and you also run daily aggregate queries for session statistics. Which table design is most appropriate?
正解: B
When you need both single-row lookup by user_id (OLTP) and aggregate queries (OLAP), Hybrid Tables are the best fit. The primary key index lets single-row access complete in milliseconds, and the columnar storage synced in the background handles aggregate queries efficiently. Clustering Keys on a standard table optimize range filters and are not sufficient to deliver low-latency point lookups.
What types of indexes can I use on Hybrid Tables?
Hybrid Tables automatically create an index on the PRIMARY KEY. You can also add secondary indexes with the CREATE INDEX statement, and UNIQUE INDEXes are supported as well. Standard Snowflake tables have no concept of indexes, so this is unique to Hybrid Tables. Keep in mind that adding indexes increases storage overhead and impacts DML performance, so keep them to the minimum required.
Can I set Clustering Keys on Hybrid Tables?
No, Clustering Keys cannot be set on Hybrid Tables. Hybrid Tables use a row-oriented storage structure and accelerate queries via primary key and secondary indexes. This is a different storage architecture from Clustering Keys, which assume the columnar micro-partition layout. The basic rule of thumb: use standard tables with Clustering Keys for OLAP workloads, and Hybrid Tables for mixed OLTP+OLAP workloads.
Can Hybrid Table data be replicated to other Snowflake regions?
Hybrid Tables can be replicated via database replication (failover groups), but with several constraints. At the replication target, Hybrid Tables are read-only and DML operations can only be executed in the primary region. Replication lag also means immediate visibility of the latest data is not guaranteed. If you need real-time consistency, design your application to keep its connection on the primary region.
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...