smallint
Choose PostgreSQL smallint for compact integer storage, understand range limits, and apply it safely.
integer
Use PostgreSQL integer (int4) for general-purpose whole numbers and understand range, indexing, and common patterns.
bigint
Use PostgreSQL bigint (int8) for long-lived identifiers and high-volume counters with large ranges.
numeric
Use PostgreSQL numeric/decimal for exact precision (money-like values), understand precision/scale, and performance tradeoffs.
real
Use PostgreSQL real (float4) for approximate values, understand rounding behavior, and avoid it for money.
double precision
Use PostgreSQL double precision (float8) for approximate values with higher precision, and understand tradeoffs.
Serial and Identity
Use PostgreSQL GENERATED AS IDENTITY (and legacy serial types), understand sequences, and choose safe primary key patterns.
boolean
Use PostgreSQL boolean correctly, understand TRUE/FALSE/NULL behavior, and avoid integer-boolean confusion.
bit
Use PostgreSQL bit and bit varying types for fixed-length bit strings and understand when booleans or integers are better.