---
title: "Getting Data Into ClickHouse - Part 1"
description: "ClickHouse can load a 28.7M-row, 4.6GB gzipped Hacker News CSV with a single command, using schema inference via clickhouse-local's file() and the url() table function."
url: "https://swe.quest/articles/getting-data-into-clickhouse-part-1-31fa78b8cfd1bb8c"
canonical: "https://clickhouse.com/blog/getting-data-into-clickhouse-part-1"
source: "ClickHouse"
published: "2022-08-26"
difficulty: "medium"
kind: "How-to"
reading_minutes: 11
tags: ["analytics","sql","databases"]
---

# Getting Data Into ClickHouse - Part 1

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2022-08-26, 11 min read, How-to. Original: [https://clickhouse.com/blog/getting-data-into-clickhouse-part-1](https://clickhouse.com/blog/getting-data-into-clickhouse-part-1)

## Summary

ClickHouse can load a 28.7M-row, 4.6GB gzipped Hacker News CSV with a single command, using schema inference via clickhouse-local's file() and the url() table function. Inferred schemas are best-effort, with Nullable Float64 and String types everywhere. Defining explicit types (UInt32, Enum, LowCardinality, DateTime) with ORDER BY id improves the result: loading from a local file with INFILE took about 94s versus 204s streaming from the URL. Sample analytical queries then scan the full table in under 2 seconds, even with ILIKE text filters.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [SQL](https://swe.quest/tags/sql.md) (Languages)
- [Databases](https://swe.quest/tags/databases.md) (Data & databases)

## Prerequisites

- SQL basics ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- command-line tools

## Keywords

ClickHouse, clickhouse-local, clickhouse-client, MergeTree, Hacker News, ClickHouse Cloud

## Related posts

- [Extracting, Converting, and Querying Data in Local Files using clickhouse-local](https://swe.quest/articles/extracting-converting-and-querying-data-in-local-files-using-clickhouse-local-46ff61f0273cc3b7.md): ClickHouse · 2023-01-04 · Medium · 13 min read · Analytics & OLAP, SQL, Data pipelines, Developer tools
  clickhouse-local runs ClickHouse's SQL engine as a standalone CLI, so you can query, transform and convert local, piped, HTTP, S3, MySQL or Postgres data without deploying a server.
- [Getting Data Into ClickHouse - Part 2 - A JSON detour](https://swe.quest/articles/getting-data-into-clickhouse-part-2-a-json-detour-fe37737f4af7d8af.md): ClickHouse · 2022-09-01 · Medium · 9 min read · Analytics & OLAP, Databases, SQL
  ClickHouse's experimental JSON (Object('json')) type, introduced around 22.8, stores semi-structured rows by automatically inferring sub-columns and representing them internally as Tuples with minimal-width numeric types.
- [What’s New in ClickHouse 22.1](https://swe.quest/articles/what-s-new-in-clickhouse-22-1-dbe5057974c6a557.md): ClickHouse · 2022-01-26 · Medium · 8 min read · Analytics & OLAP, Databases, Distributed databases
  ClickHouse 22.1 adds schema inference for table functions like url, s3, file and hdfs, detecting format and compression from the file extension and reading column types from self-describing formats such as Native, Parquet, Avro and ORC.
- [Optimizing ClickHouse with Schemas and Codecs](https://swe.quest/articles/optimizing-clickhouse-with-schemas-and-codecs-795411feff5942b1.md): ClickHouse · 2022-12-14 · Medium · 23 min read · Analytics & OLAP, Storage engines, Performance engineering, SQL
  Tightening a ClickHouse schema with strict types cuts a 1B-row NOAA weather dataset from 131.58 GiB to 71.38 GiB uncompressed.
- [The world’s fastest tool for querying JSON files](https://swe.quest/articles/the-world-s-fastest-tool-for-querying-json-files-5bf7115ac2686d02.md): ClickHouse · 2022-10-14 · Easy · 3 min read · Performance engineering, Analytics & OLAP, SQL
  clickhouse-local, a single-binary SQL engine for local and remote files, outperforms SPySQL, jq, trdsql, Miller, OctoSQL, spark-sql, Pandas and DSQ when querying large JSON files in the SPySQL benchmark on Amazon book reviews data.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
