I have been tasked to convert some Oracle DB's to Postgresql, using AWS Schema Conversion Tool. Oracle only has the Number[(precision[,scale])] type. It would seem that Oracle stores integers using fixed-point. A lot of ID columns are defined as Number(19,0) which is being converted to Numeric(19,0) by SCT.
I've even seen one (so far) simple Number which is converted to Double Precision.
Postgres has proper scalar integer types like bigint.
On first blush it seems that storing integers as fixed-point numbers would be grossly inefficient in both storage and time compared to simple integers.
Am I missing something, does Oracle store them as efficient scalar ints under-the-covers?
Out of interest what's the best type for a simple ID column in Oracle?
Oracle's number data type is a variable length data type, which means that the value
1uses less storage (and memory) than123456789In theory
number(19,0)should be mapped tobigint, however Oracle'snumber(19,0)allows storing a value like9999999999999999999which would exceed the range for abigintin Postgres.The bigget value a
bigintcan store is9223372036854775807- if that is enough for you, then stick withbigint.If you really need higher values, you will have to bite the bullet and use
numericin Postgres.