From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: derek.anderson@mspmac.org
To: pgsql-bugs@postgresql.org
Subject: Re: BUG #12675: BIGINT Datatype performance
Date: Tue, 27 Jan 2015 13:38:39 +0200
Message-ID: <54C778BF.3000205@vmware.com> (raw)
In-Reply-To: <20150126210437.19767.89672@wrigleys.postgresql.org>
References: <20150126210437.19767.89672@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On 01/26/2015 11:04 PM, derek.anderson@mspmac.org wrote:
> The following bug has been logged on the website:
>
> Bug reference: 12675
> Logged by: Derek Anderson
> Email address: derek.anderson@mspmac.org
> PostgreSQL version: 9.4.0
> Operating system: Linux
> Description:
>
> I did some testing on bigint vs double precision datatype performance for a
> project we have going on here.
>
> To my surprise, I found the double precision (floating) was well over 200%
> faster than bigint in aggregate functions. I don't know if this qualifies
> as a bug, but it sure seems odd considering non-floating type datatypes
> usually perform much faster than floating.
>
> Please contact me if you wish to discuss.
The built-in aggregates on bigint, like sum and avg, use numeric
internally because the sum of bigints can easily be too large to fit in
a bigint. Their return type is also numeric for the same reason.
Arithmetic on numeric is much slower than on double.
There is a patch being discussed that would help with that, for 9.5. See
http://www.postgresql.org/message-id/544BB5F1.50709@proxel.se. With the
patch, the aggregates would use a 128-bit integer type for the internal
calculations, making them much faster.
- Heikki
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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-bugs@postgresql.org
Cc: hlinnakangas@vmware.com, derek.anderson@mspmac.org
Subject: Re: BUG #12675: BIGINT Datatype performance
In-Reply-To: <54C778BF.3000205@vmware.com>
References: <20150126210437.19767.89672@wrigleys.postgresql.org> <54C778BF.3000205@vmware.com>
* 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