- 論壇徽章:
- 0
|
本帖最后由 wanzai01 于 2014-02-15 09:47 編輯
我的硬件:
i5 2450M 2.5G
8G 內(nèi)存
西部數(shù)據(jù) 500G 5400轉(zhuǎn)硬盤
東芝L生活本
Win7 x64
PostgreSQL 9.3.2 for win-x64
測試如下 :
單步提交性能約1.7萬TPS.
100條每個batch的批量提交的話性能約12.5萬記錄每秒
E:\proc\PostgreSQL\9.3\bin>psql.exe -U postgres postgres
用戶 postgres 的口令:
psql (9.3.2)
輸入 "help" 來獲取幫助信息.
postgres=# create database digoal with template template0 encoding 'UTF8';
CREATE DATABASE
postgres=# create role digoal nosuperuser login encrypted password 'digoal';
CREATE ROLE
postgres=# grant all on database digoal to digoal;
GRANT
postgres=# \c digoal digoal
digoal=> create schema digoal;
CREATE SCHEMA
digoal=> create table test(id serial8 primary key, info text, crt_time timestamp default clock_timestamp());
CREATE TABLE
vi $PGDATA/pg_hba.conf
host all all 127.0.0.1/32 trust
vi $PGDATA/postgresql.conf
shared_buffers = 2048MB
maintenance_work_mem = 256MB
vacuum_cost_delay = 10
vacuum_cost_limit = 10000
bgwriter_delay = 10ms
synchronous_commit = off
wal_buffers = 16384kB
wal_writer_delay = 10ms
checkpoint_segments = 128
effective_cache_size = 8192MB
log_destination = 'csvlog'
log_truncate_on_rotation = on
log_checkpoints = on
log_error_verbosity = verbose
log_autovacuum_min_duration = 0
autovacuum_freeze_max_age = 1500000000
vacuum_freeze_table_age = 1200000000
重啟服務(wù)
vi e:\test.sql
insert into test (info) values (md5(random()::text));
E:\proc\PostgreSQL\9.3\bin>pgbench -M prepared -n -r -f e:\test.sql -c 6 -j 2 -T
10 -U digoal digoal
transaction type: Custom query
scaling factor: 1
query mode: prepared
number of clients: 6
number of threads: 2
duration: 10 s
number of transactions actually processed: 166166
tps = 16604.667059 (including connections establishing)
tps = 17022.521990 (excluding connections establishing)
statement latencies in milliseconds:
0.350674 insert into test (info) values (md5(random()::text));
50條一個batch, 約2.5kTPS, 轉(zhuǎn)換成記錄數(shù)約12.5萬條每秒
E:\proc\PostgreSQL\9.3\bin>pgbench -M prepared -n -r -f e:\test.sql -c 8 -j 2 -T
10 -U digoal digoal
transaction type: Custom query
scaling factor: 1
query mode: prepared
number of clients: 8
number of threads: 2
duration: 10 s
number of transactions actually processed: 25118
tps = 2476.191514 (including connections establishing)
tps = 2549.831205 (excluding connections establishing)
statement latencies in milliseconds:
3.130863 insert into test (info) values ('test'),('test'),('test'
),('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test
'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),('tes
t'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),('te
st'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),('t
est'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),('
test'),('test'),('test');
E:\proc\PostgreSQL\9.3\bin>psql -U digoal digoal
psql (9.3.2)
輸入 "help" 來獲取幫助信息.
digoal=> select count(*) from test;
count
---------
1741639
(1 行記錄)
digoal=> select * from test limit 5;
id | info | crt_time
----+----------------------------------+-------------------------
1 | fcf4f7dd1d05420683596be124fb1fc8 | 2014-02-15 09:36:02.614
2 | 8cec0d844b653441c09cbc6699ab6ed0 | 2014-02-15 09:36:02.624
3 | b86cd74a4c069bd9967d30d65ea414f4 | 2014-02-15 09:36:02.625
4 | f969b073918087a568d5f73135068fe7 | 2014-02-15 09:36:02.626
5 | 24ca01ee37f66568b549678b8c98b3a0 | 2014-02-15 09:36:02.627
(5 行記錄)
如需其他幫助可瀏覽我的blog
推薦瀏覽 :
新手建議, PG優(yōu)化案例分析, PG培訓視頻
http://blog.163.com/digoal@126/b ... 040201172183022203/
http://www.tudou.com/home/digoal
http://blog.163.com/digoal@126/b ... 7040201392641033482
http://blog.163.com/digoal@126/b ... 7040201221382150858
|
|