How to store unsigned int in postgres sql server?

How to store unsigned int (uint32) in postgres? I noticed that a numeric (10.0) will match the number of digits, but is it the best?

In the course of further research, another similar problem is to save uint64. I found a numeric (20.0) check (BETWEEN 0 AND '18446744073709551615' :: numeric (20,0)). There are probably no native types for this.

+5
source share
1 answer

Numeric arithmetic is very slow compared to integer types.

Use bigint . It stores an 8-byte integer up to 2^63 - 1 = 9223372036854775807

[You probably don't need the entire unsigned range]

+3
source

Source: https://habr.com/ru/post/1202113/


All Articles