Snowflake Solutions Expertise and
Community Trusted By

Enter Your Email Address Here To Join Our Snowflake Solutions Community For Free

Snowflake Solutions Community

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

0

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

Daniel Steinhold Answered question August 6, 2023
0

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:

```sql
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

Sign in with google.com

To continue, google.com will share your name, email address, and profile picture with this site.

Harness the Power of Data with ITS Solutions

Innovative Solutions for Comprehensive Data Management

Feedback on Q&A