devto 2026-06-25 원문 보기 ↗
Modern organizations generate massive amounts of data that need to be stored and analyzed efficiently. As data volumes continue to grow, storing everything inside a database can become expensive and difficult to manage.
Amazon S3 has become one of the most popular storage solutions for building data lakes because it offers virtually unlimited, durable, and cost-effective object storage. At the same time, ClickHouse® is known for delivering extremely fast analytical queries on large datasets.
By integrating ClickHouse® with Amazon S3, organizations can query data directly from their data lake without first importing it into database tables. This reduces storage duplication, simplifies data pipelines, and enables fast analytics over massive datasets.
Amazon Simple Storage Service (S3) is a cloud-based object storage service that allows organizations to store and retrieve virtually unlimited amounts of data.
It is widely used for storing:
Because of its scalability, durability, and low storage cost, Amazon S3 serves as the foundation for many modern data lake architectures.
A data lake is a centralized repository that stores structured, semi-structured, and unstructured data in its original format.
Unlike traditional databases, data lakes do not require a predefined schema before storing data. Instead, data is stored as-is and processed only when needed, providing greater flexibility for analytics.
Common examples of data stored in data lakes include:
Traditionally, data stored in cloud storage is first imported into a database before it can be queried. This approach increases storage costs, duplicates data, and introduces additional ETL steps.
ClickHouse® provides native support for querying files directly from Amazon S3 using the s3() table function.
This approach offers several advantages:
ClickHouse® provides the s3() table function for reading files directly from Amazon S3.
SELECT *
FROM s3(
'https://my-bucket.s3.amazonaws.com/sales.csv',
'CSVWithNames'
)
LIMIT 10;
This query treats the CSV file as a virtual table and returns the first ten rows without importing the data into ClickHouse.
SELECT
customer_id,
SUM(amount) AS total_sales
FROM s3(
'https://my-bucket.s3.amazonaws.com/orders.parquet',
'Parquet'
)
GROUP BY customer_id
ORDER BY total_sales DESC;
Parquet is particularly efficient because ClickHouse reads only the required columns, reducing both storage reads and query execution time.
Large data lakes typically organize data across thousands of partitioned files.
ClickHouse supports wildcard patterns for querying multiple files simultaneously.
SELECT count()
FROM s3(
'https://my-bucket.s3.amazonaws.com/logs/2026/*.parquet',
'Parquet'
);
This makes it easy to analyze large datasets without manually combining files.
Although querying data directly from S3 is convenient, frequently accessed datasets can be imported into ClickHouse tables for even better performance.
CREATE TABLE sales
ENGINE = MergeTree
ORDER BY customer_id AS
SELECT *
FROM s3(
'https://my-bucket.s3.amazonaws.com/sales.parquet',
'Parquet'
);
This method creates the table and loads the data in a single query, making it useful for quick analysis and experimentation.
Create the table schema.
CREATE TABLE sales
(
customer_id UInt32,
order_id UInt64,
amount Float64,
order_date Date
)
ENGINE = MergeTree
ORDER BY customer_id;
Then insert the data.
INSERT INTO sales
SELECT *
FROM s3(
'https://my-bucket.s3.amazonaws.com/sales.parquet',
'Parquet'
);
This approach offers greater control over schema design and is commonly used in production environments.
Importing frequently queried datasets provides several advantages:
ClickHouse® supports reading several popular file formats directly from Amazon S3.
| Format | Typical Use Case |
|---|---|
| CSV | General-purpose data exchange |
| JSON | APIs and application data |
| Parquet | Analytics and data lakes |
| ORC | Big data processing |
| TSV | Tab-separated datasets |
Among these formats, Parquet is generally the best choice for analytical workloads because of its columnar storage format and efficient compression.
To achieve the best performance when querying S3 data with ClickHouse®:
Analyze application logs and server logs stored in Amazon S3 without importing them into ClickHouse.
Generate reports from archived datasets directly within the data lake.
Use ClickHouse as a high-performance query engine on top of an S3-based data lake.
Power dashboards and analytics platforms using data stored directly in Amazon S3.
ClickHouse® and Amazon S3 together provide a powerful solution for modern data lake analytics. By allowing users to query data directly from object storage, ClickHouse eliminates unnecessary data movement while delivering exceptional analytical performance.
Whether you're analyzing logs, exploring historical business data, or building a scalable data warehouse, integrating ClickHouse® with Amazon S3 simplifies data architectures, reduces infrastructure costs, and enables fast, efficient analytics at scale.