博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
BenchmarkSQL安装使用介绍
阅读量:7146 次
发布时间:2019-06-29

本文共 6564 字,大约阅读时间需要 21 分钟。

hot3.png

1、安装配置

下载地址:http://sourceforge.net/projects/benchmarksql/?source=navbar

Required:JDK7

PostgreSQL Version:9.3.4

解压:

[postgres@localhost ~]$ unzip benchmarksql-4.1.0.zip

保留配置备份:

[postgres@localhost ~]$ cd benchmarksql-4.1.0/run/[postgres@localhost run]$ cp props.pg props.pg.bak

修改数据库连接配置:

[postgres@localhost run]$ vi props.pgdriver=org.postgresql.Driverconn=jdbc:postgresql://localhost:5432/benchmarksqluser=benchmarksqlpassword=passwordwarehouses=1terminals=1//To run specified transactions per terminal- runMins must equal zerorunTxnsPerTerminal=10//To run for specified minutes- runTxnsPerTerminal must equal zerorunMins=0//Number of total transactions per minutelimitTxnsPerMin=300//The following five values must add up to 100//The default percentages of 45, 43, 4, 4 & 4 match the TPC-C specnewOrderWeight=45paymentWeight=43orderStatusWeight=4deliveryWeight=4stockLevelWeight=4

创建测试库:

postgres=# create user benchmarksql with superuser password 'password';CREATE ROLEpostgres=# create database benchmarksql owner benchmarksql;CREATE DATABASE

创建测试表结构:

[postgres@localhost run]$ ./runSQL.sh props.pg sqlTableCreates

查看测试表:

[postgres@localhost run]$ psql benchmarksql benchmarksqlpsql (9.3.4)Type "help" for help.benchmarksql=# \d                  List of relations    Schema    |    Name     |   Type   |    Owner     --------------+-------------+----------+-------------- benchmarksql | customer    | table    | benchmarksql benchmarksql | district    | table    | benchmarksql benchmarksql | hist_id_seq | sequence | benchmarksql benchmarksql | history     | table    | benchmarksql benchmarksql | item        | table    | benchmarksql benchmarksql | new_order   | table    | benchmarksql benchmarksql | oorder      | table    | benchmarksql benchmarksql | order_line  | table    | benchmarksql benchmarksql | stock       | table    | benchmarksql benchmarksql | warehouse   | table    | benchmarksql(10 rows)

导入测试数据:

[postgres@localhost run]$ ./runLoader.sh props.pg numWarehouses 1

查看表:

benchmarksql=# \d+                                List of relations    Schema    |    Name     |   Type   |    Owner     |    Size    | Description --------------+-------------+----------+--------------+------------+------------- benchmarksql | customer    | table    | benchmarksql | 18 MB      |  benchmarksql | district    | table    | benchmarksql | 8192 bytes |  benchmarksql | hist_id_seq | sequence | benchmarksql | 8192 bytes |  benchmarksql | history     | table    | benchmarksql | 2552 kB    |  benchmarksql | item        | table    | benchmarksql | 10192 kB   |  benchmarksql | new_order   | table    | benchmarksql | 416 kB     |  benchmarksql | oorder      | table    | benchmarksql | 2024 kB    |  benchmarksql | order_line  | table    | benchmarksql | 30 MB      |  benchmarksql | stock       | table    | benchmarksql | 34 MB      |  benchmarksql | warehouse   | table    | benchmarksql | 8192 bytes | (10 rows)benchmarksql=# select count(*) from customer ; count ------- 30000(1 row)benchmarksql=# select * from warehouse; w_id |   w_ytd   | w_tax  | w_name |     w_street_1      |  w_street_2  |    w_city    | w_state |   w_zip   ------+-----------+--------+--------+---------------------+--------------+--------------+---------+-----------    1 | 300000.00 | 0.0445 | RfHUW  | HldcTUzsMXqRYwvseXe | TgpQzWZsRMCc | WgCgqczSIpzF | DT      | 123456789(1 row)

为测试表创建索引:

[postgres@localhost run]$ ./runSQL.sh props.pg sqlIndexCreates

查看索引:

benchmarksql=# \di                           List of relations    Schema    |        Name        | Type  |    Owner     |   Table    --------------+--------------------+-------+--------------+------------ benchmarksql | history_pkey       | index | benchmarksql | history benchmarksql | ndx_customer_name  | index | benchmarksql | customer benchmarksql | ndx_oorder_carrier | index | benchmarksql | oorder benchmarksql | pk_customer        | index | benchmarksql | customer benchmarksql | pk_district        | index | benchmarksql | district benchmarksql | pk_item            | index | benchmarksql | item benchmarksql | pk_new_order       | index | benchmarksql | new_order benchmarksql | pk_oorder          | index | benchmarksql | oorder benchmarksql | pk_order_line      | index | benchmarksql | order_line benchmarksql | pk_stock           | index | benchmarksql | stock benchmarksql | pk_warehouse       | index | benchmarksql | warehouse(11 rows)

至此配置完成。

若需要重新导入数据,则无需删除表结构,只需在导入前执行:

./runSQL.sh props.pg sqlTableTruncates

2、测试

[postgres@localhost run]$ ./runBenchmark.sh props.pg2014-05-13 06:58:56,125  INFO - Term-00, 2014-05-13 06:58:56,129  INFO - Term-00, +-------------------------------------------------------------+2014-05-13 06:58:56,129  INFO - Term-00,      BenchmarkSQL v4.12014-05-13 06:58:56,129  INFO - Term-00, +-------------------------------------------------------------+2014-05-13 06:58:56,129  INFO - Term-00,  (c) 2003, Raul Barbosa2014-05-13 06:58:56,130  INFO - Term-00,  (c) 2004-2014, Denis Lussier2014-05-13 06:58:56,132  INFO - Term-00, +-------------------------------------------------------------+2014-05-13 06:58:56,133  INFO - Term-00, 2014-05-13 06:58:56,134  INFO - Term-00, driver=org.postgresql.Driver2014-05-13 06:58:56,135  INFO - Term-00, conn=jdbc:postgresql://localhost:5432/benchmarksql2014-05-13 06:58:56,136  INFO - Term-00, user=benchmarksql2014-05-13 06:58:56,137  INFO - Term-00, 2014-05-13 06:58:56,138  INFO - Term-00, warehouses=12014-05-13 06:58:56,138  INFO - Term-00, terminals=12014-05-13 06:58:56,140  INFO - Term-00, runTxnsPerTerminal=102014-05-13 06:58:56,141  INFO - Term-00, limitTxnsPerMin=3002014-05-13 06:58:56,141  INFO - Term-00, 2014-05-13 06:58:56,142  INFO - Term-00, newOrderWeight=452014-05-13 06:58:56,143  INFO - Term-00, paymentWeight=432014-05-13 06:58:56,144  INFO - Term-00, orderStatusWeight=42014-05-13 06:58:56,145  INFO - Term-00, deliveryWeight=42014-05-13 06:58:56,146  INFO - Term-00, stockLevelWeight=42014-05-13 06:58:56,146  INFO - Term-00, 2014-05-13 06:58:58,480  INFO - Term-00,     Current tpmTOTAL: 12    Memory Usage: 6MB / 15MB2014-05-13 06:58:58,481  INFO - Term-00, 2014-05-13 06:58:58,481  INFO - Term-00, Measured tpmC (NewOrders) = 86.162014-05-13 06:58:58,482  INFO - Term-00, Measured tpmTOTAL = 315.942014-05-13 06:58:58,485  INFO - Term-00, Session Start     = 2014-05-13 06:58:562014-05-13 06:58:58,485  INFO - Term-00, Session End       = 2014-05-13 06:58:582014-05-13 06:58:58,487  INFO - Term-00, Transaction Count = 10

改变测试策略只需在执行测试前修改props.pg即可。

转载于:https://my.oschina.net/lianshunke/blog/265287

你可能感兴趣的文章
极光大数据告诉你,程序员们都在"愁"些啥?
查看>>
前端基础知识学习记录(三)
查看>>
LeanCloud + Ionic3 迅速重构应用
查看>>
chrome扩展推荐:帮你留住每一次ctrl+c --- Clipboard History 2
查看>>
Spring Web Services 3.0.4.RELEASE和2.4.3.RELEASE发布
查看>>
配置一次,到处运行:将配置与运行时解耦
查看>>
菜鸟成都未来园区启动,无人车首次进入园区调拨运输环节 ...
查看>>
算法不扎实的程序员,每个都很慌
查看>>
Element 2.6.3 发布,基于 Vue 2.0 的桌面端组件库
查看>>
基于kubeadm的kubernetes高可用集群部署
查看>>
定位「数字化助手」,腾讯想用服务创新助力产业智慧升级
查看>>
golang之sync.Mutex互斥锁源码分析
查看>>
SAP增强的PA教材内容
查看>>
C#使用Xamarin开发可移植移动应用(3.Xamarin.Views控件)附源码
查看>>
Java 模拟基于UDP的Socket通信
查看>>
有关 Windows Lite 的一切,只为对抗 Chrome OS?
查看>>
NG-ZORRO 7.0.1 发布,Ant Design 的 Angular 实现
查看>>
scala笔记(三)
查看>>
大数据应用安全研究报告(11家公司实践详解)
查看>>
MES之殇和工业IOT之春
查看>>