Re: Numeric performances - Mailing list pgsql-general

From Tom Lane
Subject Re: Numeric performances
Date
Msg-id 19101.1180967738@sss.pgh.pa.us
Whole thread Raw
In response to Re: Numeric performances  (Vincenzo Romano <vincenzo.romano@gmail.com>)
Responses Re: Numeric performances  (PFC <lists@peufeu.com>)
List pgsql-general
Vincenzo Romano <vincenzo.romano@gmail.com> writes:
> It sounds quite strange to me that numeric is faster than bigint.

This test is 100% faulty, because it fails to consider the fact that the
accumulator used by sum() isn't necessarily the same type as the input
data.  In fact we sum ints in a bigint and bigints in a numeric to avoid
overflow.

If you try it with max() you'd likely get less-surprising answers.

            regards, tom lane

pgsql-general by date:

Previous
From: Ron St-Pierre
Date:
Subject: Re: [Fwd: Re: Autovacuum keeps vacuuming a table disabled in pg_autovacuum]
Next
From: Madison Kelly
Date:
Subject: Re: High-availability