Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Show all

ClickHouse Data Type

Updated on 2024-07-19 GMT+08:00

This section describes the data types of MRS ClickHouse.

For details about the ClickHouse data types, see ClickHouse Data Types.

Table 1 ClickHouse data types

Category

Keyword

Data Type

Description

Data type

Int8

Int8

Value range: [–128, 127]

Int16

Int16

Value range: [–32768, 32767]

Int32

Int32

Value range: [–2147483648, 2147483647]

Int64

Int64

Value range: [–9223372036854775808, 9223372036854775807]

Floating point type

Float32

Float

Similar to the Float type in C, a single-precision floating point number occupies 4 bytes in storage of a computer and is described in 32-bit binary mode.

Float64

Double

Similar to the Double type in the C language, a double-precision floating point number occupies eight bytes in the machine and is described in 64-bit binary mode.

Decimal type

Decimal

Decimal

A signed fixed-point number that can maintain precision during addition, subtraction, and multiplication operations. The following formats are supported:

  • Decimal(P, S)
  • Decimal32(S)
  • Decimal64(S)
  • Decimal128(S)
NOTE:
  • P: precision. Valid range: [1:38]. It determines the number of decimal digits (including fractions) that can be contained.
  • S: scale. The value ranges from 0 to P, which determines the number of decimal places in the decimal part of a number.

String type

String

String

The character string can be of any length. It can contain any set of bytes, including empty bytes. Therefore, the string type can replace the VARCHAR, BLOB, and CLOB types in other DBMSs.

FixedString

Fixed-length string

When the length of the data happens to be N bytes, the FixedString type is efficient. In other cases, this may reduce efficiency. Examples of values that can be effectively stored in columns of the FixedString type:

  • IP address represented in binary (IPv6 uses FixedString (16))
  • Language code (ru_RU, en_US...)
  • Currency code
  • Hash value represented in binary mode (FixedString (16) for MD5 and FixedString (32) for SHA256)

Time and date type

Date

Date

The value is stored in two bytes, indicating the date value from 1970-01-01 (unsigned) to the current time. The time zone information is not stored in the date.

DateTime

Timestamp

Stores Unix timestamps in four bytes (unsigned). Allows values within the same range as the date type to be stored. The minimum value is 1970-01-01 00:00:00. The timestamp type value is accurate to second (no leap second). The time zone uses the system time zone when the client or server is started.

DateTime64

DateTime64

This type allows you to store a time value in the form of date plus time.

Boolean type

Boolean

Boolean

ClickHouse does not have a separate type to store Boolean values. The UInt8 type can be used. The value can be 0 or 1.

Array type

Array

Array

Array(T): array consisting of T-type elements. T The value can be of any type, including the array type. However, multi-dimensional arrays are not recommended. ClickHouse has limited support for multi-dimensional arrays. For example, you cannot store multidimensional arrays in a MergeTree table.

Tuple type

Tuple

Tuple

Tuple(T1, T2, ...), tuple, in which each element has a separate type and tuples cannot be stored in tables (except memory tables). They can be used for temporary column grouping. In a query, IN expressions and lambda functions with specific parameters can be used to group temporary columns.

Domains data type

Domains

Domains

Domains types are implementation-specific types:

IPv4 is a Domains type that is binary compatible with the UInt32 type and is used to store the value of an IPv4 address. It provides more compact binary storage while supporting recognition of more readable input and output formats.

IPv6 is a domain type that is binary compatible with the FixedString (16) type and is used to store the value of an IPv6 address. It provides more compact binary storage while supporting recognition of more readable input and output formats.

Enumerated type

Enum8

Enum8

Value range: [–128, 127]

Enum stores the mapping of'string'= integer, for example, Enum8('hello' = 1, 'world' = 2).

Enum16

Enum16

Value range: [–32768, 32767]

Nullable type

Nullable

Nullable

Unless otherwise specified in the ClickHouse server configuration, NULL is the default value for any Nullable type. Nullable fields cannot be contained in table indexes.

It can be stored together with the normal value of TypeName. For example, columns of the Nullable(Int8) type can store values of the Int8 type, while rows without values store NULL.

Nested type

nested

nested

A nested data structure is like a table within a cell. The parameters (column name and type) of the nested data structure are specified in the same way as in the CREATE TABLE query. Each table row can correspond to any number of rows in a nested data structure.

Example: Nested (Name1 Type1,Name2 Type2, ...)

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback