Re: New version of money type

From: Andrew - Supernews <andrew+nonews(at)supernews(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: New version of money type
Date: 2006-09-15 16:15:04
Message-ID: slrneglkc8.2ea3.andrew+nonews@atlantis.supernews.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2006-09-15, "D'Arcy J.M. Cain" <darcy(at)druid(dot)net> wrote:
>> Seems? Have you benchmarked it?
>
> Not rigourously but a few "ANALYZE EXPLAIN" statements bear out this
> observation.

The overhead of EXPLAIN ANALYZE is so large that it completely swamps any
real difference.

>> The point is that bigint is _not_ faster than numeric for I/O (in fact
>> even integer is not faster than numeric for output).
>>
>> Numbers from an actual benchmark:
>>
>> int4out(0) - 0.42us/call
>> numeric_out(0) - 0.32us/call
>>
>> int4out(1000000000) - 0.67us/call
>> numeric_out(1000000000) - 0.42us/call
>
> Whay benchmark is this?

Simple queries output to /dev/null. Use \timing in psql to get times.

First measure the benchmark overhead:

select null::integer from generate_series(1,1000) s1,
generate_series(1,1000) s2;

Since output functions are strict, this does not call int4out at all, so
this measures the time taken to generate the million rows, output and discard
them.

Then do the real tests:

select 0::integer from generate_series(1,1000) s1,
generate_series(1,1000) s2;

This calls int4out(0) a million times. (the input function is only called
once since it is a constant, and therefore handled during planning)

select 0::numeric from generate_series(1,1000) s1,
generate_series(1,1000) s2;

This calls numeric_out(0) a million times. And so on.

--
Andrew, Supernews
http://www.supernews.com - individual and corporate NNTP services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew - Supernews 2006-09-15 16:15:24 Re: New version of money type
Previous Message Tom Lane 2006-09-15 16:11:50 Re: confusing comment in tqual.c