本文共 4534 字,大约阅读时间需要 15 分钟。
CentOS 5.8 x64PostgreSQL 9.3.2编译器 : gccpg_configBINDIR = /opt/pgsql9.3.2/binDOCDIR = /opt/pgsql9.3.2/share/docHTMLDIR = /opt/pgsql9.3.2/share/docINCLUDEDIR = /opt/pgsql9.3.2/includePKGINCLUDEDIR = /opt/pgsql9.3.2/includeINCLUDEDIR-SERVER = /opt/pgsql9.3.2/include/serverLIBDIR = /opt/pgsql9.3.2/libPKGLIBDIR = /opt/pgsql9.3.2/libLOCALEDIR = /opt/pgsql9.3.2/share/localeMANDIR = /opt/pgsql9.3.2/share/manSHAREDIR = /opt/pgsql9.3.2/shareSYSCONFDIR = /opt/pgsql9.3.2/etcPGXS = /opt/pgsql9.3.2/lib/pgxs/src/makefiles/pgxs.mkCONFIGURE = '--prefix=/opt/pgsql9.3.2' '--with-pgport=5432' '--with-perl' '--with-python' '--with-tcl' '--with-openssl' '--with-pam' '--without-ldap' '--with-libxml' '--with-libxslt' '--enable-thread-safety' '--with-wal-blocksize=16'CC = gccCPPFLAGS = -D_GNU_SOURCE -I/usr/include/libxml2CFLAGS = -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapvCFLAGS_SL = -fpicLDFLAGS = -L../../../src/common -Wl,-rpath,'/opt/pgsql9.3.2/lib',--enable-new-dtagsLDFLAGS_EX = LDFLAGS_SL = LIBS = -lpgport -lpgcommon -lxslt -lxml2 -lpam -lssl -lcrypto -lz -lreadline -ltermcap -lcrypt -ldl -lm VERSION = PostgreSQL 9.3.2
FreeBSD 10 x64PostgreSQL 9.3.4编译器 : ccpg_configBINDIR = /opt/pgsql9.3.4/binDOCDIR = /opt/pgsql9.3.4/share/docHTMLDIR = /opt/pgsql9.3.4/share/docINCLUDEDIR = /opt/pgsql9.3.4/includePKGINCLUDEDIR = /opt/pgsql9.3.4/includeINCLUDEDIR-SERVER = /opt/pgsql9.3.4/include/serverLIBDIR = /opt/pgsql9.3.4/libPKGLIBDIR = /opt/pgsql9.3.4/libLOCALEDIR = /opt/pgsql9.3.4/share/localeMANDIR = /opt/pgsql9.3.4/share/manSHAREDIR = /opt/pgsql9.3.4/shareSYSCONFDIR = /opt/pgsql9.3.4/etcPGXS = /opt/pgsql9.3.4/lib/pgxs/src/makefiles/pgxs.mkCONFIGURE = 'CPPFLAGS=-I/usr/local/include' '--prefix=/opt/pgsql9.3.4' '--with-pgport=5432' '--with-perl' '--with-python' '--with-tcl' '--with-openssl' '--with-pam' '--without-ldap' '--with-libxml' '--with-libxslt' '--enable-thread-safety' '--with-wal-blocksize=16'CC = ccCPPFLAGS = -I/usr/local/include -I/usr/local/include/libxml2 -I/usr/includeCFLAGS = -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapvCFLAGS_SL = -fPIC -DPICLDFLAGS = -L../../../src/common -L/usr/local/lib -L/usr/lib -Wl,--as-needed -Wl,-R'/opt/pgsql9.3.4/lib'LDFLAGS_EX = LDFLAGS_SL = LIBS = -lpgport -lpgcommon -lxslt -lxml2 -lpam -lssl -lcrypto -lz -lreadline -lcrypt -lm VERSION = PostgreSQL 9.3.4
postgres@digoal:~ % pg_ctl promoteserver promotingpostgres@digoal:~ % psqlpsql (9.3.4)Type "help" for help.postgres=> create table test(id int primary key, info text, crt_time timestamp);CREATE TABLEpostgres=> create or replace function f(v_id int) returns void as $$postgres$> declarepostgres$> beginpostgres$> update test set info=md5(now()::text),crt_time=now() where id=v_id;postgres$> if not found thenpostgres$> insert into test values (v_id, md5(now()::text), now());postgres$> end if;postgres$> exception when others thenpostgres$> return;postgres$> end;postgres$> $$ language plpgsql strict;sCREATE FUNCTIONpostgres=> select f(1); f --- (1 row)postgres=> select * from test; id | info | crt_time ----+----------------------------------+---------------------------- 1 | 9de5370fe00c7ed52b48080e2fb3efc9 | 2014-06-27 19:07:14.725201(1 row)postgres=> select f(1); f --- (1 row)postgres=> select * from test; id | info | crt_time ----+----------------------------------+---------------------------- 1 | f91841b8d4a52cb4ce82e835aa161283 | 2014-06-27 19:07:20.969022(1 row)postgres@digoal:~ % cdpostgres@digoal:~ % vi test.sql\setrandom v_id 1 50000000select f(:v_id);postgres@digoal:~ % pgbench -M prepared -n -r -f ./test.sql -c 16 -j 4 -T 30transaction type: Custom queryscaling factor: 1query mode: preparednumber of clients: 16number of threads: 4duration: 30 snumber of transactions actually processed: 1512165tps = 50368.843235 (including connections establishing)tps = 50416.031069 (excluding connections establishing)statement latencies in milliseconds: 0.001875 \setrandom v_id 1 50000000 0.313934 select f(:v_id);[参考]
转载地址:http://aqovx.baihongyu.com/