PostgreSQL Data Types Reference

All PostgreSQL data types with storage size, range and alias names.

Searchable PostgreSQL type reference covering numeric, character, binary, boolean, date/time, JSON, network, geometric and array types — with storage size, value range and common aliases.

When should I use numeric instead of float?

Use numeric (decimal) whenever exactness matters, such as money or quantities, because it stores values precisely. real and double precision are inexact binary floats and will accumulate rounding errors.

Pick the right PostgreSQL type quickly

PostgreSQL has a rich set of built-in data types across numeric, character, date/time, JSON, network, geometric and array categories. This reference lets you search those types by name, alias or range and filter by category, so you can choose the smallest correct type for each column. It runs entirely in your browser.

How it works

Each entry lists the canonical type name, common aliases (e.g. int4 for integer), the category, the storage size and the value range or notes. Fixed-width types like integer and bigint always occupy the same number of bytes, while variable-length types such as text, numeric and jsonb store only the bytes they need plus a small length header. Choose types like this:

CREATE TABLE invoice (
  id        bigserial PRIMARY KEY,
  total     numeric(12,2) NOT NULL,
  paid_at   timestamptz,
  metadata  jsonb
);

Tips and examples

  • Use bigint/bigserial for identifiers that may exceed two billion rows over the lifetime of a table — switching later is painful.
  • Index jsonb columns with a GIN index to make containment queries (@>) fast.
  • numeric without a precision allows arbitrary precision; add (precision, scale) like numeric(12,2) to constrain it.
  • For network data prefer inet/cidr over text: they validate input and let you query by subnet.