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

推荐订阅源

Martin Fowler
Martin Fowler
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
博客园_首页
宝玉的分享
宝玉的分享
S
SegmentFault 最新的问题
Jina AI
Jina AI
Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
美团技术团队
IT之家
IT之家
罗磊的独立博客
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
月光博客
月光博客
Microsoft Azure Blog
Microsoft Azure Blog
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Last Week in AI
Last Week in AI
博客园 - 叶小钗
M
MIT News - Artificial intelligence
B
Blog RSS Feed
有赞技术团队
有赞技术团队
Y
Y Combinator Blog

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 22 of 100 Days of ClickHouse: Exploring High-Speed An...
Kanishga Subramani · 2026-06-17 · via DEV Community

One of the most common questions developers ask when working with ClickHouse® is:

"How should I store JSON data?"

The answer isn't as simple as choosing between a String column and the native JSON data type. It depends on how your application ingests, stores, and queries data.

JSON has become the standard format for modern applications. Every API request, application log, event stream, telemetry record, and user interaction is typically represented as JSON before it reaches a database. Its schema flexibility makes it ideal for evolving systems where new attributes can appear without requiring immediate database migrations.

However, analytical databases are built for speed, and speed comes from structure.

Historically, the most common approach in ClickHouse® was storing JSON as a String and extracting fields during query execution using functions like JSONExtractString(), JSONExtractUInt(), and JSONExtractBool(). This approach is incredibly flexible because the original document is preserved exactly as it was received.

But there's a trade-off.

Every query that accesses a field has to parse the JSON document again. On small datasets, this overhead is negligible. On billions of rows, repeatedly parsing JSON becomes expensive and increases CPU utilization.

This is one of the reasons why ClickHouse introduced the native JSON data type.

Instead of treating JSON as plain text, ClickHouse understands the document's structure internally. More importantly, it uses lazy parsing, meaning only the fields referenced in a query are processed. If your query only needs user_id, ClickHouse doesn't waste time parsing every nested attribute in the document.

This significantly improves efficiency for many semi-structured workloads while preserving the flexibility developers expect from JSON.

That said, native JSON isn't a silver bullet.

One of the biggest misconceptions is believing that once native JSON is available, every attribute should remain inside a JSON object.

In reality, query patterns should drive schema design.

If a field is frequently used in WHERE clauses, GROUP BY operations, joins, dashboards, or reports, it usually deserves its own dedicated column. Structured columns allow ClickHouse to optimize storage, indexing, and query execution far better than repeatedly navigating JSON paths.

This leads to what many production systems adopt: a hybrid approach.

Core business attributes—such as user_id, event_type, or timestamp—are stored as dedicated columns because they're queried constantly. Additional metadata that changes frequently or isn't accessed often remains inside a JSON column.

This provides the best of both worlds:

  • Fast analytical queries
  • Flexible schemas
  • Simpler ingestion pipelines
  • Lower maintenance as applications evolve

Another important lesson is that ingestion patterns and query patterns are rarely the same.

Just because data arrives as JSON doesn't mean it should be stored exactly that way forever. Designing your schema around how analysts and applications actually consume data often leads to much better long-term performance.

As developers, it's easy to focus on making ingestion simple. But in analytical systems, query performance is usually what determines the overall user experience.

My biggest takeaway from today's learning is that JSON is a tool—not a schema design strategy.

ClickHouse gives us multiple options:

  • Store raw JSON as String
  • Use the native JSON data type for evolving schemas
  • Model frequently accessed attributes as dedicated columns

Choosing the right combination depends on your workload, your data, and your query patterns.

Understanding these trade-offs is what separates a database that simply works from one that scales efficiently as your data grows from millions to billions of records.

How are you handling JSON in your analytics stack? Are you using native JSON, traditional extraction functions, or a hybrid schema?

I'd love to hear about your experience.

Read more... https://quantrail-data.com/working-with-json-in-clickhouse-guide/