All Products
Search
Document Center

AnalyticDB:Data types

Last Updated:Mar 28, 2026

AnalyticDB for PostgreSQL supports the data types listed below. To define a custom type, run a CREATE TYPE statement.

Supported data types

Types are grouped by category. Each entry shows its alias, storage size, value range, and a short description.

Numeric types

Use integer for most whole-number columns — it balances range, storage, and performance. Use smallint only when storage is a hard constraint. Use bigint when values exceed the integer range. For exact decimal arithmetic (for example, financial calculations), use decimal/numeric rather than double precision or real, which are inexact floating-point types.

Data typeAliasLengthRangeDescription
smallintint22 bytes-32768 to +32767Small-range integer.
integerint, int44 bytes-2,147,483,648 to +2,147,483,647Standard integer.
bigintint88 bytes-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807Large-range integer.
decimal [ (p, s) ]numeric [ (p, s) ]VariableUnlimitedExact user-specified precision.
realfloat44 bytes6 significant digitsInexact, variable-precision floating-point.
double precisionfloat88 bytes15 significant digitsInexact, variable-precision floating-point.
float
money8 bytes-92,233,720,368,547,758.08 to +92,233,720,368,547,758.07Monetary amount.

Serial (auto-increment) types

Data typeAliasLengthRangeDescription
serialserial44 bytes1 to 2,147,483,647Auto-incrementing integer.
bigserialserial88 bytes1 to 9,223,372,036,854,775,807Auto-incrementing large integer.

Character types

Use text or varchar for most text columns. Use char(n) only when a fixed-width representation is required by an external system — it pads shorter values with spaces.

Data typeAliasLengthRangeDescription
character [ (n) ]char [ (n) ]1 byte + nUp to n charactersFixed-length, blank-padded string.
character varying [ (n) ]varchar [ (n) ]1 byte + string sizeUp to n charactersVariable-length string with an upper limit.
text1 byte + string sizeUnlimitedVariable-length string with no limit.

Binary types

Data typeAliasLengthRangeDescription
bytea1 byte + binary string1 or 4 bytes plus the actual binary stringVariable-length binary string.

Date and time types

Data typeAliasLengthRangeDescription
date4 bytes4713 BC to 294,277 ADCalendar date (year, month, day).
time [ (p) ] [ without time zone ]8 bytes00:00:00[.000000] to 24:00:00[.000000]Time of day, no time zone.
time [ (p) ] with time zonetimetz12 bytes00:00:00+1359 to 24:00:00-1359Time of day with time zone.
timestamp [ (p) ] [ without time zone ]8 bytes4713 BC to 294,277 ADDate and time, no time zone.
timestamp [ (p) ] with time zonetimestamptz8 bytes4713 BC to 294,277 ADDate and time with time zone.
interval [ (p) ]12 bytes-178,000,000 to 178,000,000 yearsTime span.

Boolean type

Data typeAliasLengthRangeDescription
booleanbool1 bytetrue/false, t/f, yes/no, y/n, 1/0Logical Boolean value.

Bit string types

Data typeAliasLengthRangeDescription
bit [ (n) ]n bitsBit string constantFixed-length bit string.
bit varying [ (n) ]varbitVariableBit string constantVariable-length bit string.

Network address types

Data typeAliasLengthDescription
cidr12 or 24 bytesIPv4 and IPv6 networks.
inet12 or 24 bytesIPv4 and IPv6 hosts and networks.
macaddr6 bytesMAC address.

Text search and document types

Data typeAliasLengthRangeDescription
json1 byte + JSON sizeJSON stringA string with an unlimited variable length.
xml1 byte + XML sizeUnlimitedA string with an unlimited variable length.

UUID type

Data typeAliasLengthDescription
uuid32 bytesUniversally unique identifier.
uuid is built into AnalyticDB for PostgreSQL V6.0. On V4.3, install the uuid-ossp extension before using this type. For details, see Use the uuid-ossp extension.

Geometric types

Geometric types (box, circle, lseg, path, point, polygon) cannot be used as distribution key columns.
Data typeAliasLengthRangeDescription
box32 bytes((x1,y1),(x2,y2))Rectangular box on a plane.
circle24 bytes<(x,y),r> (center and radius)Circle on a plane.
lseg32 bytes((x1,y1),(x2,y2))Line segment on a plane.
path16+16n bytes[(x1,y1),...]Geometric path on a plane.
point16 bytes(x,y)Geometric point on a plane.
polygon40+16n bytes((x1,y1),...)Closed geometric path on a plane.