Re: Is it necessary to rewrite table while increasing the scale of datatype numeric???

From: Noah Misch <noah(at)leadboat(dot)com>
To: wangshuo(at)highgo(dot)com(dot)cn
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Is it necessary to rewrite table while increasing the scale of datatype numeric???
Date: 2013-09-05 11:57:39
Message-ID: 20130905115739.GA155093@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 05, 2013 at 11:07:43AM +0800, wangshuo(at)highgo(dot)com(dot)cn wrote:
> ??? 2013-09-04 19:30, Noah Misch ??????:
>> On Wed, Sep 04, 2013 at 12:08:48PM +0800, wangshuo(at)highgo(dot)com(dot)cn
>> wrote:
>>> I find that it takes a long time when I increase the scale of a
>>> numeric
>>> datatype.
>>> By checking the code, I found that's because it needs to rewrite
>>> that
>>> table's file.
>>> After checking that table's data file, I found only parameter
>>> n_header
>>> changed.
>>> And, I found the data in that numeric field never changed.
>>> So I thank It's not necessary to rewrite the table's file in this
>>> case.
>>
>
> Noah Misch <noah(at)leadboat(dot)com> wrote:
>> n_header is part of the numeric field's data. That's not just
>> pedantry: the
>> display scale stored in n_header affects how numeric_out() formats the
>> value.
>
> Thanks for your reply.
>
> Just because of what you said, I think increasing scale only lead to
> differently
> diaplay. There's no difference between 5.25 and 5.2500 in use.
> So thers's no need to rewrite the table.

Right or wrong, our numeric type caters to applications that do care about the
difference between those outputs. I grant that others do not care.

--
Noah Misch
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2013-09-05 12:47:32 get rid of SQL_ASCII?
Previous Message Haribabu kommi 2013-09-05 11:43:03 Re: Performance Improvement by reducing WAL for Update Operation