Skip to main content
Database & SQL Tools

PostgreSQL Data Type Reference

A searchable reference of PostgreSQL data types - numeric, character, date/time, JSONB, arrays, UUID, and network types.

Search or browse PostgreSQL's data types by category, including some PostgreSQL-specific types like JSONB, arrays, and UUID.

For the equivalent reference on a different database, see the MySQL Data Type Reference or SQL Server Data Type Reference.

What Is This Reference?

A searchable list of PostgreSQL's data types, including several types less common in other databases - native array columns, the UUID type, network address types (inet, cidr), and both JSON and the more commonly recommended JSONB.

Why Use This Tool?

PostgreSQL's richer type system offers genuinely useful options (like JSONB's indexing support, versus plain JSON) that aren't obvious if you're used to a simpler type system. This reference explains what each one is actually good for.

How to Use It

  1. Search for a type name or keyword.
  2. Review its description and typical use case.

Limitations

This covers commonly-used PostgreSQL types - for full behavioral detail on any one type, PostgreSQL's own documentation remains authoritative.

Choosing Types: Quick Recommendations

You needUseWhy
Auto-incrementing IDbigint GENERATED ALWAYS AS IDENTITYThe modern replacement for serial
Public or distributed IDuuidUnguessable, can be created in the app
Text of any lengthtextSame performance as varchar in PostgreSQL
Moneynumeric(12,2)Exact decimals - never real or double precision
Point in timetimestamptzStores an absolute moment, avoiding time zone bugs
Flexible attributesjsonbIndexable with GIN, faster to query than json
List of tagstext[]Native arrays with @> and ANY() queries
IP addressinetValidation plus subnet operators

Example Table

CREATE TABLE orders (
    id          bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    public_id   uuid NOT NULL DEFAULT gen_random_uuid(),
    total       numeric(12,2) NOT NULL,
    tags        text[] NOT NULL DEFAULT '{}',
    meta        jsonb NOT NULL DEFAULT '{}',
    created_at  timestamptz NOT NULL DEFAULT now()
);

gen_random_uuid() is built in from PostgreSQL 13.

Compare with the MySQL and SQL Server references, or build a table with the SQL Table Generator.

Frequently Asked Questions

Use JSONB in most cases. It is stored in a binary format that is faster to query and supports indexes; JSON keeps the exact original text, including key order and whitespace.

No. In PostgreSQL they are stored the same way. Use VARCHAR(n) only when you want the database to enforce a maximum length.

TIMESTAMPTZ (timestamp with time zone). It stores an absolute moment in time and avoids most time zone bugs.
Share this tool: