Unlock this content

Enter your email to unlock this content for free

By continuing, you agree to our Terms of Service and Privacy Notice, and to receive occasional marketing emails.

IPv4, IPv6

TL;DR

Use ClickHouse's native IPv4 and IPv6 types for efficient storage, validation, and manipulation of IP addresses. They store addresses as compact integers, saving 50-70% storage compared to strings.

IP Address Types

ClickHouse provides IPv4 and IPv6 types optimized for IP addresses. Benefits: compact storage (IPv4 as UInt32/4 bytes, IPv6 as FixedString(16)/16 bytes), automatic validation, and native IP functions.

Using IP Types

IPv4: Stored as UInt32 (4 bytes). Use for IPv4 addresses.

IPv6: Stored as FixedString(16) (16 bytes). Use for IPv6 addresses.

CREATE TABLE access_logs (

Tinybird is not affiliated with, associated with, or sponsored by ClickHouse, Inc. ClickHouse® is a registered trademark of ClickHouse, Inc.

IPv4, IPv6 | ClickHouse for Developers