Getting Data Into ClickHouse - Part 3 - Using S3
ClickHouse can both query data in place on Amazon S3 and ingest it, shown here on an 11.5-billion-row, ~600GB forex tick dataset stored as zstd CSV and Parquet. The s3 table function supports glob patterns and schema inference for ad-hoc queries. A full-dataset aggregation over all 66 pairs took about 583s on one node, about 435s with max_download_threads=12, and about 226s when distributed across the cluster with s3Cluster (roughly 50M rows/s). The examples also use window functions to find the largest daily spread changes and note that Parquet files parse less parallelly than CSV.
Related posts
- A Deep Dive into Apache Parquet with ClickHouse - Part 1
ClickHouse mediumAdept
ClickHouse can read and write Apache Parquet through its file and s3 table functions, using the same Parquet code in ClickHouse Local and ClickHouse Server. Examples on a 28M-row UK house price dataset show schema inspection with DESCRIBE and aggregation queries over local files, S3 objects and glob-matched file sets. Writes can go through INSERT INTO FUNCTION, INTO OUTFILE or FORMAT Parquet redirection, and PARTITION BY splits output into one file per year. INSERT INTO FUNCTION produces smaller files (243MB vs 291MB) than the client-side approaches, so it is recommended where possible.
- ClickHouse and The One Trillion Row Challenge
ClickHouse mediumAdept
ClickHouse answers Dask's One Trillion Row Challenge (min/avg/max temperature per station over 2.4TiB of Parquet in S3) in under 3 minutes for $0.56 by querying the data in place with the s3 function on an ephemeral cluster of AWS spot instances provisioned and torn down with Pulumi. ARM c7g.12xlarge instances were chosen on spot price per vCPU and availability, since the workload was CPU-bound rather than network-bound. Raising max_download_buffer_size to 50MB so each ~25MB file is fetched by a single thread cut S3 read wait, increased throughput to ~920MB/s and dropped a 111-billion-row test from 454s to 303s, with further thread tuning following. Loading the data into a MergeTree first would answer the query in 16 seconds, at the cost of load time.
- ClickHouse Release 23.8
ClickHouse mediumAdept
ClickHouse 23.8 makes file reads much faster by using Parquet row-group min/max statistics to skip data, answering count() from file metadata, and pruning files via the _file virtual column without reading them. On a 126GiB PyPI Parquet dataset in GCS, a count dropped from 26.5s to 11.4s, a time-range filter from 84s to 35s, and a 10% filename sample from 4.6s to 0.6s. The release also adds the S3Queue table engine for streaming ingestion from S3. It tracks processed files in ClickHouse Keeper using an unordered mode (with TTL and file-count limits) or an ordered mode keyed on filenames. Direct querying of zip, tar and 7z archives via the file function is also new.
- Bring high-performance analytics to your lakehouse with ClickHouse and Amazon S3 Tables
ClickHouse mediumAdept
ClickHouse's DataLakeCatalog engine connects to Amazon S3 Tables through the Iceberg REST endpoint, exposing a table bucket as a ClickHouse database that can be queried in place and written back to, with no data copied out. Reads resolve snapshots via the catalog and prune Parquet columns and row groups. Writes commit through an atomic metadata pointer swap authorized by SigV4/IAM, using a least-privilege policy that includes s3tables:UpdateTableMetadataLocation. A retail walkthrough on ClickHouse 26.8 joins purchases and returns, then writes a curated Iceberg table that other engines and AI agents can reuse. Caveats include single-level namespaces, DROP TABLE requiring purge=true, no ClickHouse Cloud support yet, and a recommendation to materialize into MergeTree for high-concurrency, low-latency dashboards.
- ClickHouse is data lake ready
ClickHouse mediumAdept
ClickHouse now queries Apache Iceberg and Delta Lake tables in place on S3, GCS and Azure, either directly or through catalogs such as AWS Glue, Unity, Polaris, BigLake, OneLake and Iceberg REST. Teams can load lake data into the native MergeTree engine when they need sub-second, high-concurrency queries, and can write results back to open formats. The groundwork took two years of releases: a native Parquet reader with page-level parallelism that reads about 1.8x faster on ClickBench, integration of the Delta Rust Kernel, Iceberg time travel and DML, and parallel replicas. Worked examples against a 1.29-billion-row NYC taxi Iceberg table show in-place scans taking 50 to 130 seconds before ingestion into MergeTree for faster querying.