Snowflake Tables
Snowflake Tables
Transient Tables 1. Similar to permanent tables No Fail-Safe costs, Temporary data storage CREATE TRANSIENT TABLE
2. But with shorter Time-Travel and no suitable for non-urgent data. Adhoc requirements/testing transient_tbl_emp (emp_id
Fail-Safe. NUMBER, emp_join_date
3. Drop explicitly, available to other users DATE);
as per grants
Temporary Tables 1. Temporary tables exist only within the Data deleted after session ends. No 1. For adhoc testing. CREATE TEMPORARY TABLE
Session. Storage cost/Maintenance 2. Performance temp_tbl_emp (emp_id
2. Not viewable/accessible to other Analysis/Tuning. NUMBER, emp_join_date
sessions/users. 3. For Session-specific data DATE);
3. Clears out once the session ends. processing, temporary
4. Non recoverable storage
https://www.linkedin.com/in/sravankumarbodla/
Table Type Summary Benefits Use Cases Syntax
Dynamic Dynamic tables are tables that materialize Automated transformation, ETL pipelines, dynamic data CREATE Dynamic TABLE
Tables the results of a specified query. reduces complexity and transformation. Physicalizing <table_name>
Materializing complex queries/Building economical. complex query/views, To TARGET_LAG=<duration>
tables with existing Improve Query performance. WAREHOUSE=<warehouse_name>
tables/queries/transformations using SQL. AS <select query....>;
Directory 1. Stores file-level metadata about data Simplifies data management, File management, accessing CREATE STAGE sales_srcfiles_info_stg
Tables files in stages. supports both Snowflake and file metadata, Helps in URL='s3://load/files/'
2. Both external (external cloud storage) external stages. planning while building STORAGE_INTEGRATION =
and internal (Snowflake) stages support Provides a list of all datafiles in pipelines. my_storage_int
directory tables. the stage by Querying. DIRECTORY = (ENABLE = TRUE);
Hybrid Tables 1. Power Unistore with transactional High performance for OLTP, OLTP applications, fast row- CREATE OR REPLACE HYBRID TABLE
(Preview capabilities & row-based storage (Column supports transactional level operations. - Preview sales (
feature - Open & Row - dual storage internally). capabilities. sale_id NUMBER PRIMARY KEY ,
for use) 2. Requires Primary Key, supports Sale_date DATE NOT NULL);
referential integrity , indexes etc
3. Snowpipe , Timetravel, Failsafe is not
supported currently
https://www.linkedin.com/in/sravankumarbodla/
Table Summary Benefits Use Cases Syntax
Type
Event Capture platform Used for auditing, Monitoring Create or replace event table events_test;
Tables logs and events monitoring, native platform usage, https://quickstarts.snowflake.com/guide/alert_on_events/index.html?index=..%2F..index#4
natively within event capturing. system event
Snowflake Capture info analysis, INS, UPD,
Captures logged based on the DEL count capture
messages from Log_Level setting - etc.
Functions/Stored Info, Error,
Procedures. Warning etc.
External 1. External table is Access external Querying data in CREATE EXTERNAL TABLE sales_ext_t
Tables file/data stored in data seamlessly, external storage, (
external stage. (Eg: cost-effective. accessing data sale_id number,
aws S3/gcp gcs/azure Cons: lakes. sale_date DATE
blob storage). Comparatively Adhoc usage )
2. Query data from lesser For Non SLA LOCATION = 's3://external-bucket/path/to/data/'
external stages as if performance as based FILE_FORMAT = (TYPE = CSV);
stored within table is external queries/reports.
Snowflake.
3. External tables are
read only (No DML),
but, can used in
joins/queries;
Supports Partitions.
https://www.linkedin.com/in/sravankumarbodla/
Table Type Summary Benefits Use Cases Syntax
Iceberg Tables 1. Table metadata is in Iceberg format. Supports data lake use cases and Data lake storage, 1. #Create External Volume to hold
2. Data is stored in Parquet files. Snowflake features with external integrating with external Parquet & Iceberg data
3. Both table metadata and data is storage ( aws S3, GCP Cloud storage storage solutions - Preview create or replace external volume
stored in customer-supplied etc). my_ext_vol
storage/External storage. STORAGE_LOCATIONS =
4. Utilize Apache Iceberg format to store ((
data and metadata externally (As of NAME = 'my-s3-us-east-1'
2024, Parquet files). STORAGE_PROVIDER = 'S3'
STORAGE_BASE_URL = 's3://my-s3-
bucket/data/snowflake_extvol/'
STORAGE_AWS_ROLE_ARN = '****'
) );
2. #Create an Iceberg Table using my
External Volume
create or replace iceberg table
my_iceberg_table
with EXTERNAL_VOLUME =
'my_ext_vol'
as select id, date, first_name,
last_name, address, region,
order_number, invoice_amount from
sales;
References: https://docs.snowflake.com/en/sql-reference/sql/create-external-table
https://docs.snowflake.com/en/sql-reference/sql/create-hybrid-table
https://docs.snowflake.com/en/sql-reference/sql/create-event-table
https://www.linkedin.com/in/sravankumarbodla/