From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | veem v <veema0000(at)gmail(dot)com> |
Cc: | "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at> |
Subject: | Re: How to do faster DML |
Date: | 2024-02-11 16:59:31 |
Message-ID: | CAKFQuwb7FvHMx6kfvYAcpLvk6JbN9JbWiGQTPVypaK_C8sxZ4w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sunday, February 11, 2024, veem v <veema0000(at)gmail(dot)com> wrote:
>
> On Sun, 11 Feb 2024 at 19:02, Peter J. Holzer <hjp-pgsql(at)hjp(dot)at> wrote:
>
>> > Similarly for Number/Numeric data type.
>>
>> Number in Oracle and numeric in PostgreSQL are variable length types.
>> But in PostgreSQL you also have a lot of fixed length numeric types
>> (from boolean to bigint as well as float4 and float8) and you would
>> normally prefer those over numeric (unless you really need a decimal or
>> very long type). So padding is something you would encounter in a
>> typical PostgreSQL database while it just wouldn't happen in a typical
>> Oracle database.
>>
>>
>> When you said *"you would normally prefer those over numeric " *I was
> thinking the opposite. As you mentioned integer is a fixed length data type
> and will occupy 4 bytes whether you store 15 or 99999999.But in case of
> variable length type like Number or numeric , it will resize itself based
> on the actual data, So is there any downside of going with the variable
> length data type like Numeric, Varchar type always for defining the data
> elements?
>
Regardless of the size of the actual data in a variable width column expect
that the size and computational overhead is going to make using that field
more costly than using a fixed width field. You don’t have a choice for
text, it is always variable width, but for numeric, if can use an integer
variant you will come out ahead versus numeric.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Ron Johnson | 2024-02-11 17:08:47 | Re: How to do faster DML |
Previous Message | veem v | 2024-02-11 16:53:58 | Re: How to do faster DML |