>> It is. But why do you care? You either have the correctness that
>> NUMERIC gives, or you don't.
>
> I suspect it's still useful to know what order of magnitude slower it
> is. After all if it is 1000x slower (not saying it is), some people may
> decide it's not worth it or roll their own.
>
> Any hints/gotchas for/when doing such performance tests?
forum_bench=> CREATE TEMPORARY TABLE test AS SELECT a::FLOAT AS f,
a::NUMERIC AS n, a::INTEGER AS i, a::BIGINT AS b FROM
generate_series( 1,100000 ) AS a;
SELECT
Temps : 1169,125 ms
forum_bench=> SELECT sum(i) FROM test;
Temps : 46,589 ms
forum_bench=> SELECT sum(b) FROM test;
Temps : 157,018 ms
forum_bench=> SELECT sum(f) FROM test;
Temps : 63,865 ms
forum_bench=> SELECT sum(n) FROM test;
Temps : 124,816 ms
SELECT * FROM test ORDER BY i LIMIT 1; SELECT * FROM test ORDER BY b LIMIT
1; SELECT * FROM test ORDER BY f LIMIT 1; SELECT * FROM test ORDER BY n
LIMIT 1;
Temps : 68,996 ms
Temps : 68,917 ms
Temps : 62,321 ms
Temps : 71,880 ms
BEGIN; CREATE INDEX test_i ON test(i); CREATE INDEX test_b ON test(b);
CREATE INDEX test_f ON test(f); CREATE INDEX test_n ON test(n); ROLLBACK;
CREATE INDEX
Temps : 102,901 ms
CREATE INDEX
Temps : 123,406 ms
CREATE INDEX
Temps : 105,255 ms
CREATE INDEX
Temps : 134,468 ms