IPAddress Types
ClickHouse provides native IP address types for efficient storage and querying.
IPv4
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}IPv6
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}Type Mapping Reference
| ClickHouse Type | TypeScript | Python |
|---|---|---|
IPv4 | string & tags.Format<"ipv4"> | IPv4Address |
IPv6 | string & tags.Format<"ipv6"> | IPv6Address |
Why use native IP types?
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.
See Also
- ClickHouse IPv4 — ClickHouse official documentation
- ClickHouse IPv6 — ClickHouse official documentation