Re: New version of money type - Mailing list pgsql-hackers

From Andrew - Supernews
Subject Re: New version of money type
Date
Msg-id slrneglkc8.2ea3.andrew+nonews@atlantis.supernews.net
Whole thread Raw
In response to New version of money type  ("D'Arcy J.M. Cain" <darcy@druid.net>)
Responses Re: New version of money type  ("D'Arcy J.M. Cain" <darcy@druid.net>)
List pgsql-hackers
On 2006-09-15, "D'Arcy J.M. Cain" <darcy@druid.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: confusing comment in tqual.c
Next
From: Andrew - Supernews
Date:
Subject: Re: New version of money type