Re: Let's drop two obsolete features which are bear-traps for novices

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: Michael Banck <michael(dot)banck(at)credativ(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Jaime Casanova <jaime(at)2ndquadrant(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Josh Berkus <josh(at)agliodbs(dot)com>, CK Tan <cktan(at)vitessedata(dot)com>
Subject: Re: Let's drop two obsolete features which are bear-traps for novices
Date: 2014-11-03 19:34:10
Message-ID: 20141103193410.GT1791@alvin.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Fetter wrote:
> On Mon, Nov 03, 2014 at 01:54:09PM +0100, Michael Banck wrote:

> > As an additional datapoint, Vitesse Data changed the DB schema from
> > NUMERIC to MONEY for their TPCH benchmark for performance reasons: "The
> > modification to data types is easy to understand -- money and double
> > types are faster than Numeric (and no one on this planet has a bank
> > account that overflows the money type, not any time soon)."[1] And
> > "Replaced NUMERIC fields representing currency with MONEY"[2].
> >
> > Not sure whether they modified/optimized PostgreSQL with respect to the
> > MONEY data type and/or how much performance that gained, so CCing CK Tan
> > as well.
>
> How does our NUMERIC type's performance compare to other systems'
> precise types? I realize that some of those systems might have
> restrictions on publishing numbers they don't authorize, but they
> might have pushed some authorized numbers if those numbers make them
> look good.

There is a real advantage of money over numeric in the performance
front. I haven't measured it, but suffice to say that money uses
integer operations which map almost directly to CPU instructions,
whereas numeric needs to decode from our varlena base-10000 digit
format, operate on digits at a time, then encode back. No matter how
much you optimize numeric, it's never going to outperform stuff that
runs practically on bare electrons. As far as I recall, some TPCH
queries run aggregations on currency columns.

Now, whether this makes a measurable difference or not in TPCH terms, I
have no idea.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2014-11-03 19:36:33 Re: Patch: add recovery_timeout option to control timeout of restore_command nonzero status code
Previous Message David Fetter 2014-11-03 19:16:54 Re: Let's drop two obsolete features which are bear-traps for novices