ClickHouse provides several string-based types optimized for different use cases.
Variable-length strings for general text data.
interface User { name: string; // String email: string; // String}Optimized storage for strings with many repeated values. Use when you have fewer than ~10,000 unique values.
import { LowCardinality } from "@514labs/moose-lib"; interface Event { status: string & LowCardinality; // LowCardinality(String) country: string & LowCardinality; // LowCardinality(String)}Use LowCardinality for columns like status codes, country codes, categories, or any string field with a limited set of repeated values. It significantly reduces storage and improves query performance.
Universally unique identifiers stored in native UUID format.
import { tags } from "typia"; interface User { id: string & tags.Format<"uuid">; // UUID}| ClickHouse Type | TypeScript | Python |
|---|---|---|
String | string | str |
LowCardinality(String) | string & LowCardinality | Annotated[str, "LowCardinality"] |
UUID | string & tags.Format<"uuid"> | UUID |