Skip to main content

PostgreSQL Data Types

PostgreSQL supports a wide range of data types, categorized into several groups.

1. Numeric Types​

NameStorage SizeDescriptionRange
smallint2 bytessmall-range integer-32768 to +32767
integer4 bytestypical choice for integer-2147483648 to +2147483647
bigint8 byteslarge-range integer-9223372036854775808 to +9223372036854775807
decimal / numericvariableuser-specified precision, exactup to 131072 digits before decimal point; up to 16383 digits after
real4 bytesvariable-precision, inexact6 decimal digits precision
double precision8 bytesvariable-precision, inexact15 decimal digits precision
smallserial2 bytessmall autoincrementing integer1 to 32767
serial4 bytesautoincrementing integer1 to 2147483647
bigserial8 byteslarge autoincrementing integer1 to 9223372036854775807

2. Character Types​

NameDescription
character(n) / char(n)fixed-length, blank padded
character varying(n) / varchar(n)variable-length with limit
textvariable-length with no limit

Note: In PostgreSQL, there is no performance difference between these three types.

3. Date/Time Types​

NameStorage SizeDescription
timestamp8 bytesboth date and time (no time zone)
timestamp with time zone8 bytesboth date and time, with time zone
date4 bytesdate (no date)
time8 bytestime of day (no date)
interval16 bytestime interval

4. Boolean Type​

The boolean type can have the state true, false, or unknown (represented by NULL).

5. Other Notable Types​

  • Geometric Types: point, line, lseg, box, path, polygon, circle.
  • Network Address Types: cidr, inet, macaddr.
  • JSON Types: json (textual), jsonb (binary, indexed).
  • UUID: uuid for universally unique identifiers.
  • XML: xml for XML data.

Back to PostgreSQL