惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
人人都是产品经理
人人都是产品经理
Engineering at Meta
Engineering at Meta
小众软件
小众软件
I
InfoQ
有赞技术团队
有赞技术团队
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Martin Fowler
Martin Fowler
月光博客
月光博客
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
SegmentFault 最新的问题
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
V
Visual Studio Blog
博客园 - 叶小钗
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
GbyAI
GbyAI
P
Proofpoint News Feed
Apple Machine Learning Research
Apple Machine Learning Research

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Day 35 – ClickHouse® and S3 Integration: Querying Data Lakes
Kanishga Subramani · 2026-06-25 · via DEV Community

Introduction

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.


What Is Amazon S3?

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:

  • CSV files
  • JSON documents
  • Parquet datasets
  • ORC files
  • Application logs
  • Backups
  • Machine learning datasets
  • Historical archives

Because of its scalability, durability, and low storage cost, Amazon S3 serves as the foundation for many modern data lake architectures.

Key Benefits

  • Virtually unlimited storage capacity
  • High durability and availability
  • Cost-effective storage for large datasets
  • Seamless integration with analytics platforms
  • Ideal for long-term data retention

What Is a Data Lake?

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:

  • Application logs
  • Business transactions
  • IoT sensor readings
  • Clickstream data
  • Machine learning datasets
  • Historical business records

Why Integrate ClickHouse® with Amazon S3?

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:

  • No data duplication
  • Faster access to large datasets
  • Lower infrastructure costs
  • Simplified ETL pipelines
  • Easy access to historical data

Querying Data from Amazon S3

ClickHouse® provides the s3() table function for reading files directly from Amazon S3.

Query a CSV File

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.


Query a Parquet File

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.


Query Multiple Files

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.


Loading Data from Amazon S3 into ClickHouse

Although querying data directly from S3 is convenient, frequently accessed datasets can be imported into ClickHouse tables for even better performance.


Method 1: Create and Load in a Single Step

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.


Method 2: Create the Table First

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.


Benefits of Loading Data into ClickHouse

Importing frequently queried datasets provides several advantages:

  • Improved query performance
  • Better schema management
  • Reduced S3 access costs
  • Faster dashboard response times
  • Ideal for production workloads

Supported File Formats

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.


Best Practices

To achieve the best performance when querying S3 data with ClickHouse®:

  • Store analytical datasets in Parquet format.
  • Partition data by date or business dimensions.
  • Query only the required columns.
  • Compress files to reduce storage costs.
  • Load frequently accessed datasets into local ClickHouse tables.
  • Organize S3 directories for efficient filtering.

Common Use Cases

1. Log Analytics

Analyze application logs and server logs stored in Amazon S3 without importing them into ClickHouse.


2. Historical Reporting

Generate reports from archived datasets directly within the data lake.


3. Data Warehousing

Use ClickHouse as a high-performance query engine on top of an S3-based data lake.


4. Business Intelligence

Power dashboards and analytics platforms using data stored directly in Amazon S3.


Conclusion

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.