ClickHouse provides native IP address types for efficient storage and querying.
Stores IPv4 addresses in 4 bytes.
import { tags } from "typia"; interface NetworkEvent { source_ip: string & tags.Format<"ipv4">; // IPv4 client_ip: string & tags.Format<"ipv4">; // IPv4}Stores IPv6 addresses in 16 bytes. Also handles IPv4-mapped IPv6 addresses.
import { tags } from "typia"; interface NetworkEvent { dest_ip: string & tags.Format<"ipv6">; // IPv6}| ClickHouse Type | TypeScript | Python |
|---|---|---|
IPv4 | string & tags.Format<"ipv4"> | IPv4Address |
IPv6 | string & tags.Format<"ipv6"> | IPv6Address |
Native IP types are more storage-efficient than strings and enable IP-specific functions like range queries, subnet matching, and CIDR operations directly in ClickHouse.