# PostgreSQL - Numeric Types

Please note, that unlike MySQL / MariaDB, PostgreSQL does *not* support adding the `UNSIGNED`

flag to any of these types.

## Integer Types

### SMALLINT

`-32768`

to`32767`

- Storage Size: 2 bytes

### INTEGER / INT

`-2147483648`

to`2147483647`

- Storage Size: 4 bytes

### BIGINT

`-9223372036854775808`

to`9223372036854775807`

- Storage Size: 4 bytes

## Auto-Incrementing Integer Types

### SMALLSERIAL

`1`

to`32767`

- Storage Size: 2 bytes

### SERIAL

`1`

to`2147483647`

- Storage Size: 4 bytes

### BIGSERIAL

`1`

to`9223372036854775807`

- Storage Size: 8 bytes

## Decimal Types

The following types are for when you need to store a number with a decimal point.

### DECIMAL / NUMERIC

- up to 131072 digits before the decimal point
- up to 16383 digits after the decimal point
**Exact precision**(e.g. not like how a float works).- Storage Size: variable based on specified scale/precision.
- E.g.
`DECIMAL(3,2)`

(will be able to store`1.23`

but*not*`12.3`

) - E.g.
`NUMERIC(3,2)`

(will be able to store`1.23`

but*not*`12.3`

)

### REAL

**Variable**precision using 6 decimal digits (e.g. like how a float works). E.g. can store`0.000000000000000123456`

or`123456000000000000000`

but not`1234567`

.- Storage Size: 4 bytes

### DOUBLE PRECISION

- Exactly like
`REAL`

except uses 8 bytes of storage in order to allow 15 decimal digits of precision. - Storage Size: 8 bytes

## References

Last updated: 3rd September 2023

First published: 15th July 2022

First published: 15th July 2022