Performance difference between int4 and int8 in PostgreSQL on 64 bit server -
Performance difference between int4 and int8 in PostgreSQL on 64 bit server -
assuming postgresql running on 64 bit server, performance difference between int4 (32 bit) , int8 (64 bit) column? manual states int4 more efficient int8, if underlying server 64 bit, there practical performance difference (in terms of (1) cpu, (2) memory , (3) storage)?
in terms of (1) cpu, (2) memory , (3) storage
put bluntly:
64 bits twice big 32 bits.
64 bits twice big 32 bits.
64 bits twice big 32 bits.
i recall thread in wp-hackers did few benchmarks. create table, fill in 1000000 rows. find, add, group, join, etc. don't recall specifics, indeed slower using int8 int4.
test=# create table int4_test (id int primary key); create table test=# create table int8_test (id bigint primary key); create table test=# insert int4_test select generate_series(1,1000000) i; insert 0 1000000 test=# insert int8_test select generate_series(1,1000000) i; insert 0 1000000 test=# vacuum analyze; vacuum test=# \timing on timing on. test=# select sum(i.id) int4_test natural bring together int4_test j i.id % 19 = 0; sum ------------- 26315710524 (1 row) time: 1364.925 ms test=# select sum(i.id) int4_test natural bring together int4_test j i.id % 19 = 0; sum ------------- 26315710524 (1 row) time: 1286.810 ms test=# select sum(i.id) int8_test natural bring together int8_test j i.id % 19 = 0; sum ------------- 26315710524 (1 row) time: 1610.638 ms test=# select sum(i.id) int8_test natural bring together int8_test j i.id % 19 = 0; sum ------------- 26315710524 (1 row) time: 1554.066 ms test=# select count(*) int4_test natural bring together int4_test j i.id % 19 = 0; count ------- 52631 (1 row) time: 1244.654 ms test=# select count(*) int4_test natural bring together int4_test j i.id % 19 = 0; count ------- 52631 (1 row) time: 1247.114 ms test=# select count(*) int8_test natural bring together int8_test j i.id % 19 = 0; count ------- 52631 (1 row) time: 1541.751 ms test=# select count(*) int8_test natural bring together int8_test j i.id % 19 = 0; count ------- 52631 (1 row) time: 1519.986 ms
performance postgresql integer
Comments
Post a Comment