📘 An Article on Different Types of Views in Snowflake
In Snowflake Inc., views are virtual tables that help simplify queries, improve security, and enhance performance. Views do not store data themselves (except materialized views). Instead, they dynamically fetch data from underlying tables.
Understanding different types of views is essential for building scalable, secure, and efficient data systems.
🔹 What Is a View?
A view is a saved SQL query that behaves like a table.
Instead of writing complex queries repeatedly, you can:
Example:
CREATE VIEW v_sales AS
SELECT id, product, amount
FROM sales
WHERE amount > 1000;
🔹 Types of Views in Snowflake
Snowflake mainly supports three types of views:
1️⃣ Standard View (Regular View)
Description
A Standard View is the most commonly used view. It stores only the SQL definition and executes the query every time it is accessed.
Characteristics
Example
CREATE VIEW v_employee AS
SELECT emp_id, name, department
FROM employees;
Use Cases
Limitations
2️⃣ Secure View
Description
A Secure View hides the underlying SQL logic and base table structure. Users cannot see how the data is generated.
It is mainly used for data security and data sharing.
Characteristics
Example
CREATE SECURE VIEW v_secure_salary AS
SELECT emp_id, salary
FROM payroll;
Use Cases
Limitations
Recommended by LinkedIn
3️⃣ Materialized View
Description
A Materialized View stores precomputed query results physically. Snowflake automatically refreshes it when base data changes.
It improves performance for heavy and repetitive queries.
Characteristics
Example
CREATE MATERIALIZED VIEW mv_sales_summary AS
SELECT product, SUM(amount) AS total_sales
FROM sales
GROUP BY product;
Use Cases
Limitations
✅ 1️⃣ Card-Style Comparison (Modern Look)
📌 Standard View
🔒 Secure View
🚀 Materialized View
🔹 Which View Should You Use?
Use Standard View When:
Use Secure View When:
Use Materialized View When:
🔹 Best Practices
🔹 Real-World Example
In a sales system:
This layered approach improves security, performance, and maintainability.