What are external tables in Snowflake, and how are they different from regular tables?


What are external tables in Snowflake, and how are they different from regular tables?

Daniel Steinhold Answered question August 6, 2023

External tables in Snowflake are a type of table that allows you to access and query data stored in external cloud-based storage platforms, such as Amazon S3, Microsoft Azure Data Lake Storage, or Google Cloud Storage. Unlike regular (internal) tables in Snowflake, which store data in Snowflake's managed storage, external tables define a schema and metadata for data that resides outside the Snowflake database.

Key differences between external tables and regular tables:

1. **Data Location:**
- Regular Tables: Store data in Snowflake's managed storage.
- External Tables: Reference data stored in external cloud storage platforms. The data remains in its original location and is accessed by Snowflake without being moved into Snowflake storage.
2. **Storage Costs:**
- Regular Tables: Snowflake manages storage, and you pay for storage usage based on your Snowflake pricing plan.
- External Tables: You pay storage costs directly to the external storage provider, which may offer cost advantages for storing large datasets.
3. **Data Ingestion and Maintenance:**
- Regular Tables: Snowflake provides automatic data replication, distribution, and optimization features.
- External Tables: You're responsible for managing the data and maintaining its integrity in the external storage. Snowflake leverages external table metadata to optimize queries but doesn't manage the data itself.
4. **Performance:**
- Regular Tables: Snowflake's architecture optimizes query performance through metadata and data clustering.
- External Tables: Query performance can vary based on the underlying external storage performance and organization.
5. **Data Format and Compression:**
- Regular Tables: Snowflake automatically handles data format conversion and compression.
- External Tables: Data format and compression must be managed externally, but Snowflake supports common formats like Parquet, ORC, CSV, JSON, etc.
6. **Use Cases:**
- Regular Tables: Well-suited for operational and analytical data that undergoes frequent updates and transformations.
- External Tables: Suitable for scenarios where data is generated and managed externally, like raw data storage, data sharing, and data lakes.
7. **Migration and ETL:**
- Regular Tables: Easier to migrate data from other databases to Snowflake's managed storage.
- External Tables: Well-suited for integrating with existing data ecosystems and pipelines.

Example of creating an external table that references data in an Amazon S3 bucket:

sqlCopy code
CREATE EXTERNAL TABLE my_external_table (
column1 STRING,
column2 INT,
LOCATION = 's3://my-s3-bucket/data/';


In this example, **`my_external_table`** is defined as an external table that points to data stored in an S3 bucket. The schema of the external table is specified, but the actual data remains in the S3 bucket.

External tables offer flexibility for integrating with external data sources, sharing data, and leveraging data lake architectures while taking advantage of Snowflake's query capabilities.

Daniel Steinhold Answered question August 6, 2023

Maximize Your Data Potential With ITS

Feedback on Q&A