Skip to main content

double precision

Learning Focus

Use this lesson to choose PostgreSQL double precision when you need floating point and more precision than real.

double precision Overview

  • Storage: 8 bytes
  • Approximate floating point
  • Best for: scientific computations, measurements, analytics

Example

CREATE TABLE geo_points (
point_id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
latitude double precision NOT NULL,
longitude double precision NOT NULL
);

Best Practices

  • Prefer double precision over real for most floating-point needs.
  • Avoid floats for exact values (use numeric).

What's Next