BenchmarkSQL测试脚本实现
sqlTableCreates
DROP SCHEMA IF EXISTS benchmarksql CASCADE;
CREATE SCHEMA benchmarksql;
create table benchmarksql.warehouse (
w_id integer not null,
w_ytd decimal(12,2),
w_tax decimal(4,4),
w_name varchar(10),
w_street_1 varchar(20),
w_street_2 varchar(20),
w_city varchar(20),
w_state char(2),
w_zip char(9)
);
create table benchmarksql.district (
d_w_id integer not null,
d_id integer not null,
d_ytd decimal(12,2),
d_tax decimal(4,4),
d_next_o_id integer,
d_name varchar(10),
d_street_1 varchar(20),
d_street_2 varchar(20),
d_city varchar(20),
d_state char(2),
d_zip char(9)
);
create table benchmarksql.customer (
c_w_id integer not null,
c_d_id integer not null,
c_id integer not null,
c_discount decimal(4,4),
c_credit char(2),
c_last varchar(16),
c_first varchar(16),
c_credit_lim decimal(12,2),
c_balance decimal(12,2),
c_ytd_payment float,
c_payment_cnt integer,
c_delivery_cnt integer,
c_street_1 varchar(20),
c_street_2 varchar(20),
c_city varchar(20),
c_state char(2),
c_zip char(9),
c_phone char(16),
c_since timestamp,
c_middle char(2),
c_data varchar(500)
);
create sequence hist_id_seq;
create table benchmarksql.history (
hist_id integer not null default nextval('hist_id_seq') primary key,
h_c_id integer,
h_c_d_id integer,
h_c_w_id integer,
h_d_id integer,
h_w_id integer,
h_date timestamp,
h_amount decimal(6,2),
h_data varchar(24)
);
create table benchmarksql.oorder (
o_w_id integer not null,
o_d_id integer not null,
o_id integer not null,
o_c_id integer,
o_carrier_id integer,
o_ol_cnt decimal(2,0),
o_all_local decimal(1,0),
o_entry_d timestamp
);
create table benchmarksql.new_order (
no_w_id integer not null,
no_d_id integer not null,
no_o_id integer not null
);
create table benchmarksql.order_line (
ol_w_id integer not null,
ol_d_id integer not null,
ol_o_id integer not null,
ol_number integer not null,
ol_i_id integer not null,
ol_delivery_d timestamp,
ol_amount decimal(6,2),
ol_supply_w_id integer,
ol_quantity decimal(2,0),
ol_dist_info char(24)
);
create table benchmarksql.stock (
s_w_id integer not null,
s_i_id integer not null,
s_quantity decimal(4,0),
s_ytd decimal(8,2),
s_order_cnt integer,
s_remote_cnt integer,
s_data varchar(50),
s_dist_01 char(24),
s_dist_02 char(24),
s_dist_03 char(24),
s_dist_04 char(24),
s_dist_05 char(24),
s_dist_06 char(24),
s_dist_07 char(24),
s_dist_08 char(24),
s_dist_09 char(24),
s_dist_10 char(24)
);
create table benchmarksql.item (
i_id integer not null,
i_name varchar(24),
i_price decimal(5,2),
i_data varchar(50),
i_im_id integer
);
sqlTableDrops
drop table benchmarksql.warehouse;
drop table benchmarksql.item;
drop table benchmarksql.stock;
drop table benchmarksql.district;
drop table benchmarksql.customer;
drop table benchmarksql.oorder;
drop table benchmarksql.order_line;
drop table benchmarksql.history;
drop table benchmarksql.new_order;
sqlIndexCreates
alter table benchmarksql.warehouse add constraint pk_warehouse
primary key (w_id);
alter table benchmarksql.district add constraint pk_district
primary key (d_w_id, d_id);
alter table benchmarksql.customer add constraint pk_customer
primary key (c_w_id, c_d_id, c_id);
create index ndx_customer_name
on benchmarksql.customer (c_w_id, c_d_id, c_last, c_first);
select setval('hist_id_seq', (select max(hist_id) + 1 from benchmarksql.history), false);
alter table benchmarksql.oorder add constraint pk_oorder
primary key (o_w_id, o_d_id, o_id);
create unique index ndx_oorder_carrier
on benchmarksql.oorder (o_w_id, o_d_id, o_carrier_id, o_id);
alter table benchmarksql.new_order add constraint pk_new_order
primary key (no_w_id, no_d_id, no_o_id);
alter table benchmarksql.order_line add constraint pk_order_line
primary key (ol_w_id, ol_d_id, ol_o_id, ol_number);
alter table benchmarksql.stock add constraint pk_stock
primary key (s_w_id, s_i_id);
alter table benchmarksql.item add constraint pk_item
primary key (i_id);
vacuum analyze;
sqlIndexDrops
alter table benchmarksql.warehouse drop constraint pk_warehouse;
alter table benchmarksql.district drop constraint pk_district;
alter table benchmarksql.customer drop constraint pk_customer;
drop index ndx_customer_name;
-- history table has no primary key
-- commit;
alter table benchmarksql.oorder drop constraint pk_oorder;
drop index ndx_oorder_carrier;
alter table benchmarksql.new_order drop constraint pk_new_order;
alter table benchmarksql.order_line drop constraint pk_order_line;
alter table benchmarksql.stock drop constraint pk_stock;
alter table benchmarksql.item drop constraint pk_item;
sqlTableCopies
copy benchmarksql.warehouse
(w_id, w_ytd, w_tax, w_name, w_street_1, w_street_2, w_city, w_state, w_zip)
from '/tmp/csv/warehouse.csv' WITH CSV;
copy benchmarksql.item
(i_id, i_name, i_price, i_data, i_im_id)
from '/tmp/csv/item.csv' WITH CSV;
copy benchmarksql.stock
(s_i_id, s_w_id, s_quantity, s_ytd, s_order_cnt, s_remote_cnt, s_data,
s_dist_01, s_dist_02, s_dist_03, s_dist_04, s_dist_05,
s_dist_06, s_dist_07, s_dist_08, s_dist_09, s_dist_10)
from '/tmp/csv/stock.csv' WITH CSV;
copy benchmarksql.district
(d_id, d_w_id, d_ytd, d_tax, d_next_o_id, d_name, d_street_1,
d_street_2, d_city, d_state, d_zip)
from '/tmp/csv/district.csv' WITH CSV;
copy benchmarksql.customer
(c_id, c_d_id, c_w_id, c_discount, c_credit, c_last, c_first, c_credit_lim,
c_balance, c_ytd_payment, c_payment_cnt, c_delivery_cnt, c_street_1,
c_street_2, c_city, c_state, c_zip, c_phone, c_since, c_middle, c_data)
from '/tmp/csv/customer.csv' WITH CSV;
copy benchmarksql.history
(hist_id, h_c_id, h_c_d_id, h_c_w_id, h_d_id, h_w_id, h_date, h_amount, h_data)
from '/tmp/csv/cust-hist.csv' WITH CSV;
copy benchmarksql.oorder
(o_id, o_w_id, o_d_id, o_c_id, o_carrier_id, o_ol_cnt, o_all_local, o_entry_d)
from '/tmp/csv/order.csv' WITH CSV;
copy benchmarksql.order_line
(ol_w_id, ol_d_id, ol_o_id, ol_number, ol_i_id, ol_delivery_d,
ol_amount, ol_supply_w_id, ol_quantity, ol_dist_info)
from '/tmp/csv/order-line.csv' WITH CSV;
copy benchmarksql.new_order
(no_w_id, no_d_id, no_o_id)
from '/tmp/csv/new-order.csv' WITH CSV;
sqlTableTruncates
truncate table benchmarksql.warehouse;
truncate table benchmarksql.item;
truncate table benchmarksql.stock;
truncate table benchmarksql.district;
truncate table benchmarksql.customer;
truncate table benchmarksql.history;
truncate table benchmarksql.oorder;
truncate table benchmarksql.order_line;
truncate table benchmarksql.new_order;
clean.sh
rm -rf log/
mkdir -p log/archive
BenchmarkSQL测试脚本实现的更多相关文章
- 使用BenchmarkSQL测试PostgreSQL
BenchmarkSQL是一款经典的开源数据库测试工具,内嵌了TPCC测试脚本,可以对EnterpriseDB.PostgreSQL.MySQL.Oracle以及SQL Server等数据库直接进行测 ...
- 使用benchmarkSQL测试数据库的TPCC
压力测试是指在MySQL上线前,需要进行大量的压力测试,从而达到交付的标准.压力测试不仅可以测试MySQL服务的稳定性,还可以测试出MySQL和系统的瓶颈. TPCC测试:Transaction Pr ...
- SPF邮件伪造漏洞测试脚本
测试脚本: # -*- coding: utf-8 -*- import socket,select,base64,os,re,time,datetime class mail: def __init ...
- 用BlazeMeter录制JMeter测试脚本
工具: 1,JMeter 2,Chrome 3,BlazeMeter 4,SwitchyOmega(如果需要代理) 步骤: 以上工具准备好以后就可以录制JMeter的测试脚本了, 在Chrome中点击 ...
- Loadrunner开发测试脚本
Loadrunner开发测试脚本 开发测试脚本可以通过录制,也可以手动开发,建议能录制的尽量录制,省时省力,不能录制的只能费力自己开发了,具体看项目情况来决定. 使用Loadrunner开发脚本过程中 ...
- 菜鸟教程之工具使用(十)——用BlazeMeter录制JMeter测试脚本
工具: 1,JMeter 2,Chrome 3,BlazeMeter 4,SwitchyOmega(如果需要代理) 步骤: 以上工具准备好以后就可以录制JMeter的测试脚本了, 在Chrome中点击 ...
- VS2010+Selenium测试脚本设计
VS2010+Selenium测试脚本设计 http://www.docin.com/p-755903506.html
- 更改QTP默认测试脚本路径
QTP的默认测试脚本路径为安装路径下的Tests文件夹下, 如果你安装在D:,那么默认脚本路径为D:\Program Files\HP\QuickTest Professional\Tests 但是因 ...
- 微信聊天测试脚本 wx_sample.php
<?php </FuncFlag> </xml>); curl_setopt($ch, CURLO ...
随机推荐
- NRF51822之GPIOTE使用
---恢复内容开始--- 在上篇介绍nrf51822的GPIOTE http://www.cnblogs.com/libra13179/p/5336580.html 我们现在开始下水游泳. /** @ ...
- c语言main函数返回值、参数详解(返回值是必须的,0表示正常退出)
C语言Main函数返回值 main函数的返回值,用于说明程序的退出状态.如果返回0,则代表程序正常退出:返回其它数字的含义则由系统决定.通常,返回非零代表程序异常退出. 很多人甚至市面上的一些书籍,都 ...
- zepto源码--定义变量--学习笔记
主要了解一下zepto定义的初始变量. 逐一以自己的理解解析,待到后面完全透彻理解之后,争取再写一遍zepto源码学习的文章. 其中的undefined确实不明白为什么定义这么个变量在这里. docu ...
- HTTP 协议的历史演变和设计思路
HTTP 协议是互联网的基础协议,也是网页开发的必备知识,最新版本 HTTP/2 更是让它成为技术热点. 本文介绍 HTTP 协议的历史演变和设计思路. 一.HTTP/0.9 HTTP 是基于 TCP ...
- graphviz - Node Shapes
Node Shapes There are three main types of shapes : polygon-based, record-based and user-defined. The ...
- [LeetCode]题解(python):102 Binary Tree Level Order Traversal
题目来源 https://leetcode.com/problems/binary-tree-level-order-traversal/ Given a binary tree, return th ...
- 简单计算器--hdu1237(栈的运用)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1237 这是单纯的本题答案: #include<stdio.h> #define N 11 ...
- JMeter学习-014-JMeter 配置元件实例之 - 用户定义的变量 参数化配置
前文讲述了通过 CSV Data Set Config 实现参数化配置(详情敬请参阅:JMeter学习-010-JMeter 配置元件实例之 - CSV Data Set Config 参数化配置), ...
- PySe-001-基础环境配置(MacOX)
Python 是一种面向对象.解释型计算机程序设计语言,其源代码同样遵循 GPL(GNU General Public License)协议.Python语法简洁而清晰,具有丰富和强大的类库.由于Py ...
- 记录:在老XPS1330上安装CentOS7
下图是设置时的图片,注意分区设置. 下图是安装成功的画面. 下图是在Gnome桌面环境打开Firefox上本博客的画面. 注意点: 1.安装时没啥特殊的,就两点,一是要分区设置好,图省事就让自动分区: ...