From: Stephen Frost <sfrost@snowman.net>
To: Charlin Barak <charlinbarak@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Oracle number to PostgreSQL
Date: Wed, 1 May 2019 09:25:18 -0400
Message-ID: <20190501132518.GC6197@tamriel.snowman.net> (raw)
In-Reply-To: <CAPrg5cZPeQGy2g4bmKX7nQcosu46Ufk9BFKdQjXouOgf5MAL9Q@mail.gmail.com>
References: <CAPrg5cZPeQGy2g4bmKX7nQcosu46Ufk9BFKdQjXouOgf5MAL9Q@mail.gmail.com>
Greetings,
* Charlin Barak (charlinbarak@gmail.com) wrote:
> When migrating from Oracle number(10,3) to PostgreSQL, is numeric(10,3)
> ideal or should I consider some other data types?
This really depends on what data is actually in that field and if you
need it to be exact.
If the field actually contains integers and always will, then using an
integer type field is *much* more efficient, either 'integer' if the
values will always be less than 2B, or 'bigint' if it'll be larger.
If the field actually contains floating point and can be inexact, then
using 'real' or 'float8' will be more efficient than numeric.
If the field needs to be exact (eg: monetary fields), then using
numeric(10,3) is correct.
I strongly recommend considering the data that goes into the field when
making this decision- there really is no 'one size fits all' when going
from number to numeric.
Thanks,
Stephen
Attachments:
signature.asc (application/pgp-signature, 818B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: sfrost@snowman.net, charlinbarak@gmail.com
Subject: Re: Oracle number to PostgreSQL
In-Reply-To: <20190501132518.GC6197@tamriel.snowman.net>
References: <CAPrg5cZPeQGy2g4bmKX7nQcosu46Ufk9BFKdQjXouOgf5MAL9Q@mail.gmail.com> <20190501132518.GC6197@tamriel.snowman.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox