SSB(Star Schema Benchmark)是麻省州立大学波士顿校区的研究人员定义的基于现实商业应用的数据模型,业界公认用来模拟决策支持类应用,比较公正和中立。
学术界和工业界普遍采用它来评价决策支持技术方面应用的性能。
全方位评测系统的整体商业计算综合能力,对厂商的要求更高。
在银行信贷分析和信用卡分析、电信运营分析、税收分析、烟草行业决策分析中都有广泛的应用。

SSB基准测试包括:
 1个事实表:lineorder
 4个维度表:customer,part,dwdate,supplier
 13条标准SQL查询测试语句:统计查询、多表关联、sum、复杂条件、group by、order by等组合方式。

SSB数据生成器


SSB数据自动生成器下载地址:点击这里

实验证明,在Linux上操作比较方便,步骤如下:

  • 将下载的文件上传至Linux主机上的目录
  • 执行如下命令,生成dbgen文件:make
  • 查看 dbgen 命令帮助: ./dbgen -h
  • 生成数据文件,命令如下:
  • (customer.tbl)
    dbgen -s 1 -T c (part.tbl)
    dbgen -s 1 -T p (supplier.tbl)
    dbgen -s 1 -T s (date.tbl)
    dbgen -s 1 -T d (fact table lineorder.tbl)
    dbgen -s 1 -T l (for all SSBM tables)
    dbgen -s 1 -T a
  • 生成文件如下: ll *tbl -l
  • 连接mysql数据库,创建数据库,数据表
  • 创建数据库: create database ssb;
  • 创建数据库表:
  • CREATE TABLE CUSTOMER ( C_CUSTKEY     INTEGER,
    C_NAME VARCHAR(25) NOT NULL,
    C_ADDRESS VARCHAR(40) NOT NULL,
    C_CITY VARCHAR(10) NOT NULL,
    C_NATION VARCHAR(15) NOT NULL,
    C_REGION VARCHAR(12) NOT NULL,
    C_PHONE VARCHAR(15) NOT NULL,
    C_MKTSEGMENT VARCHAR(10) NOT NULL); CREATE TABLE DATES ( D_DATEKEY INTEGER,
    D_DATE VARCHAR(18) NOT NULL,
    D_DAYOFWEEK VARCHAR(18) NOT NULL,
    D_MONTH VARCHAR(9) NOT NULL,
    D_YEAR INTEGER NOT NULL,
    D_YEARMONTHNUM INTEGER,
    D_YEARMONTH VARCHAR(7) NOT NULL,
    D_DAYNUMINWEEK INTEGER,
    D_DAYNUMINMONTH INTEGER,
    D_DAYNUMINYEAR INTEGER,
    D_MONTHNUMINYEAR INTEGER,
    D_WEEKNUMINYEAR INTEGER,
    D_SELLINGSEASON VARCHAR(12) NOT NULL,
    D_LASTDAYINWEEKFL INTEGER,
    D_LASTDAYINMONTHFL INTEGER,
    D_HOLIDAYFL INTEGER,
    D_WEEKDAYFL INTEGER); CREATE TABLE PART ( P_PARTKEY INTEGER,
    P_NAME VARCHAR(22) NOT NULL,
    P_MFGR VARCHAR(6) NOT NULL,
    P_CATEGORY VARCHAR(7) NOT NULL,
    P_BRAND VARCHAR(9) NOT NULL,
    P_COLOR VARCHAR(11) NOT NULL,
    P_TYPE VARCHAR(25) NOT NULL,
    P_SIZE INTEGER NOT NULL,
    P_CONTAINER VARCHAR(10) NOT NULL); CREATE TABLE SUPPLIER ( S_SUPPKEY INTEGER,
    S_NAME VARCHAR(25) NOT NULL,
    S_ADDRESS VARCHAR(25) NOT NULL,
    S_CITY VARCHAR(10) NOT NULL,
    S_NATION VARCHAR(15) NOT NULL,
    S_REGION VARCHAR(12) NOT NULL,
    S_PHONE VARCHAR(15) NOT NULL); CREATE TABLE LINEORDER ( LO_ORDERKEY BIGINT,
    LO_LINENUMBER BIGINT,
    LO_CUSTKEY INTEGER NOT NULL,
    LO_PARTKEY INTEGER NOT NULL,
    LO_SUPPKEY INTEGER NOT NULL,
    LO_ORDERDATE INTEGER NOT NULL,
    LO_ORDERPRIOTITY VARCHAR(15) NOT NULL,
    LO_SHIPPRIOTITY INTEGER,
    LO_QUANTITY BIGINT,
    LO_EXTENDEDPRICE BIGINT,
    LO_ORDTOTALPRICE BIGINT,
    LO_DISCOUNT BIGINT,
    LO_REVENUE BIGINT,
    LO_SUPPLYCOST BIGINT,
    LO_TAX BIGINT,
    LO_COMMITDATE INTEGER NOT NULL,
    LO_SHIPMODE VARCHAR(10) NOT NULL);
  • 执行完成后,结果如下:
  • 执行如下SQL、导入数据
  • set autocommit=off;
    load data infile '/dbgen/lineorder.tbl' into table LINEORDER fields terminated by '|' lines terminated by '|\n';
    commit; load data infile '/dbgen/supplier.tbl' into table SUPPLIER fields terminated by '|' lines terminated by '|\n';
    commit; load data infile '/dbgen/customer.tbl' into table CUSTOMER fields terminated by '|' lines terminated by '|\n';
    commit; load data infile '/dbgen/part.tbl' into table PART fields terminated by '|' lines terminated by '|\n';
    commit; load data infile '/dbgen/date.tbl' into table DATES fields terminated by '|' lines terminated by '|\n';
    commit;
  • 查看数据是否正确

标准SQL查询测试语句


  • PROMPT Q1.1
    SELECT SUM(LO_EXTENDEDPRICE*LO_DISCOUNT) AS
    REVENUE
    FROM LINEORDER, DATES
    WHERE LO_ORDERDATE = D_DATEKEY
    AND D_YEAR = 1993
    AND LO_DISCOUNT BETWEEN 1 AND 3
    AND LO_QUANTITY < 25; PROMPT Q1.2
    SELECT SUM(LO_EXTENDEDPRICE*LO_DISCOUNT) AS
    REVENUE
    FROM LINEORDER, DATES
    WHERE LO_ORDERDATE = D_DATEKEY
    AND D_YEARMONTH = 'Jan1994'
    AND LO_DISCOUNT BETWEEN 4 AND 6
    AND LO_QUANTITY BETWEEN 26 AND 35; PROMPT Q1.3
    SELECT SUM(LO_EXTENDEDPRICE*LO_DISCOUNT) AS
    REVENUE
    FROM LINEORDER, DATES
    WHERE LO_ORDERDATE = D_DATEKEY
    AND D_WEEKNUMINYEAR = 6
    AND D_YEAR = 1994
    AND LO_DISCOUNT BETWEEN 5 AND 7
    AND LO_QUANTITY BETWEEN 26 AND 35; PROMPT Q2.1
    SELECT SUM(LO_REVENUE), D_YEAR, P_BRAND
    FROM LINEORDER, DATES, PART, SUPPLIER
    WHERE LO_ORDERDATE = D_DATEKEY
    AND LO_PARTKEY = P_PARTKEY
    AND LO_SUPPKEY = S_SUPPKEY
    AND P_CATEGORY = 'MFGR#12'
    AND S_REGION = 'AMERICA'
    GROUP BY D_YEAR, P_BRAND
    ORDER BY D_YEAR, P_BRAND; PROMPT Q2.2
    SELECT SUM(LO_REVENUE), D_YEAR, P_BRAND
    FROM LINEORDER, DATES, PART, SUPPLIER
    WHERE LO_ORDERDATE = D_DATEKEY
    AND LO_PARTKEY = P_PARTKEY
    AND LO_SUPPKEY = S_SUPPKEY
    AND P_BRAND BETWEEN 'MFGR#2221'
    AND 'MFGR#2228'
    AND S_REGION = 'ASIA'
    GROUP BY D_YEAR, P_BRAND
    ORDER BY D_YEAR, P_BRAND; PROMPT Q2.3
    SELECT SUM(LO_REVENUE), D_YEAR, P_BRAND
    FROM LINEORDER, DATES, PART, SUPPLIER
    WHERE LO_ORDERDATE = D_DATEKEY
    AND LO_PARTKEY = P_PARTKEY
    AND LO_SUPPKEY = S_SUPPKEY
    AND P_BRAND= 'MFGR#2239'
    AND S_REGION = 'EUROPE'
    GROUP BY D_YEAR, P_BRAND
    ORDER BY D_YEAR, P_BRAND; PROMPT Q3.1
    SELECT C_NATION, S_NATION, D_YEAR,
    SUM(LO_REVENUE) AS REVENUE
    FROM CUSTOMER, LINEORDER, SUPPLIER, DATES
    WHERE LO_CUSTKEY = C_CUSTKEY
    AND LO_SUPPKEY = S_SUPPKEY
    AND LO_ORDERDATE = D_DATEKEY
    AND C_REGION = 'ASIA'
    AND S_REGION = 'ASIA'
    AND D_YEAR >= 1992 AND D_YEAR <= 1997
    GROUP BY C_NATION, S_NATION, D_YEAR
    ORDER BY D_YEAR ASC, REVENUE DESC; PROMPT Q3.2
    SELECT C_CITY, S_CITY, D_YEAR, SUM(LO_REVENUE)
    AS REVENUE
    FROM CUSTOMER, LINEORDER, SUPPLIER, DATES
    WHERE LO_CUSTKEY = C_CUSTKEY
    AND LO_SUPPKEY = S_SUPPKEY
    AND LO_ORDERDATE = D_DATEKEY
    AND C_NATION = 'UNITED STATES'
    AND S_NATION = 'UNITED STATES'
    AND D_YEAR >= 1992 AND D_YEAR <= 1997
    GROUP BY C_CITY, S_CITY, D_YEAR
    ORDER BY D_YEAR ASC, REVENUE DESC; PROMPT Q3.3
    SELECT C_CITY, S_CITY, D_YEAR, SUM(LO_REVENUE)
    AS REVENUE
    FROM CUSTOMER, LINEORDER, SUPPLIER, DATES
    WHERE LO_CUSTKEY = C_CUSTKEY
    AND LO_SUPPKEY = S_SUPPKEY
    AND LO_ORDERDATE = D_DATEKEY
    AND (C_CITY='UNITED KI1'
    OR C_CITY='UNITED KI5')
    AND (S_CITY='UNITED KI1'
    OR S_CITY='UNITED KI5')
    AND D_YEAR >= 1992 AND D_YEAR <= 1997
    GROUP BY C_CITY, S_CITY, D_YEAR
    ORDER BY D_YEAR ASC, REVENUE DESC; PROMPT Q3.4
    SELECT C_CITY, S_CITY, D_YEAR, SUM(LO_REVENUE)
    AS REVENUE
    FROM CUSTOMER, LINEORDER, SUPPLIER, DATES
    WHERE LO_CUSTKEY = C_CUSTKEY
    AND LO_SUPPKEY = S_SUPPKEY
    AND LO_ORDERDATE = D_DATEKEY
    AND (C_CITY='UNITED KI1'
    OR C_CITY='UNITED KI5')
    AND (S_CITY='UNITED KI1'
    OR S_CITY='UNITED KI5')
    AND D_YEARMONTH = 'Dec1997'
    GROUP BY C_CITY, S_CITY, D_YEAR
    ORDER BY D_YEAR ASC, REVENUE DESC; PROMPT Q4.1
    SELECT D_YEAR, C_NATION,
    SUM(LO_REVENUE - LO_SUPPLYCOST) AS PROFIT
    FROM DATES, CUSTOMER, SUPPLIER, PART, LINEORDER
    WHERE LO_CUSTKEY = C_CUSTKEY
    AND LO_SUPPKEY = S_SUPPKEY
    AND LO_PARTKEY = P_PARTKEY
    AND LO_ORDERDATE = D_DATEKEY
    AND C_REGION = 'AMERICA'
    AND S_REGION = 'AMERICA'
    AND (P_MFGR = 'MFGR#1'
    OR P_MFGR = 'MFGR#2')
    GROUP BY D_YEAR, C_NATION
    ORDER BY D_YEAR, C_NATION; PROMPT Q4.2
    SELECT D_YEAR, S_NATION, P_CATEGORY,
    SUM(LO_REVENUE - LO_SUPPLYCOST) AS PROFIT
    FROM DATES, CUSTOMER, SUPPLIER, PART, LINEORDER
    WHERE LO_CUSTKEY = C_CUSTKEY
    AND LO_SUPPKEY = S_SUPPKEY
    AND LO_PARTKEY = P_PARTKEY
    AND LO_ORDERDATE = D_DATEKEY
    AND C_REGION = 'AMERICA'
    AND S_REGION = 'AMERICA'
    AND (D_YEAR = 1997 OR D_YEAR = 1998)
    AND (P_MFGR = 'MFGR#1'
    OR P_MFGR = 'MFGR#2')
    GROUP BY D_YEAR, S_NATION, P_CATEGORY
    ORDER BY D_YEAR, S_NATION, P_CATEGORY; PROMPT Q4.3
    SELECT D_YEAR, S_CITY, P_BRAND,
    SUM(LO_REVENUE - LO_SUPPLYCOST) AS PROFIT
    FROM DATES, CUSTOMER, SUPPLIER, PART, LINEORDER
    WHERE LO_CUSTKEY = C_CUSTKEY
    AND LO_SUPPKEY = S_SUPPKEY
    AND LO_PARTKEY = P_PARTKEY
    AND LO_ORDERDATE = D_DATEKEY
    AND S_NATION = 'UNITED STATES'
    AND (D_YEAR = 1997 OR D_YEAR = 1998)
    AND P_CATEGORY = 'MFGR#14'
    GROUP BY D_YEAR, S_CITY, P_BRAND
    ORDER BY D_YEAR, S_CITY, P_BRAND;
  • nfobright 342 on linux 64

SSB基准测试的更多相关文章

  1. MatrixOne从入门到实践08——SSB性能测试

    MatrixOne从入门到实践--SSB性能测试 SSB 星型模式基准测试是 OLAP 数据库性能测试的常用场景,通过本篇教程,您可以了解到如何在 MatrixOne 中实现 SSB 测试. 测试环境 ...

  2. 一篇文章看懂TPCx-BB(大数据基准测试工具)源码

    TPCx-BB是大数据基准测试工具,它通过模拟零售商的30个应用场景,执行30个查询来衡量基于Hadoop的大数据系统的包括硬件和软件的性能.其中一些场景还用到了机器学习算法(聚类.线性回归等).为了 ...

  3. JavaScript的基准测试-不服跑个分?

    原文:Bulletproof JavaScript benchmarks 做JavaScript的基准测试并没有想的那么简单.即使不考虑浏览器差异所带来的影响,也有很多难点-或者说陷阱需要面对. 这是 ...

  4. mysql benchmark基准测试

    git项目地址: https://github.com/akopytov/sysbench 利用sysbench很容易对mysql做性能基准测试(当然这个工具很强大,除了测试主流数据库性能,还能测试其 ...

  5. 掌握 Linux PC 性能之基准测试

    导读 基准测试是一项测试或一系列测试,用来确定某个计算机硬件运行起来的状况有多好:在许多情况下,“基准测试”实际上等同于“压力测试”,通过测试硬件的极限,然后可以将测得的结果与其他硬件测得的结果作一番 ...

  6. mysql基准测试

    1. 及注册时有两种主要的策略:①正对整个系统的整体测试(集成式full-stack) ②单独测试mysql(但组件式基准测试single-component) 2.获取系统性能和状态(需要记录的数据 ...

  7. [译]使用JMH进行微基准测试:不要猜,要测试!

    英文原文:Micro Benchmarking with JMH: Measure, don't guess!翻译地址:使用JMH进行微基准测试:不要猜,要测试!原文作者:Antonio翻译作者:Ho ...

  8. Java监控工具介绍,VisualVm ,JProfiler,Perfino,Yourkit,Perf4J,JProbe,Java微基准测试

    本文是本人前一段时间做一个简单Java监控工具调研总结,主要包括VisualVm ,JProfiler,Perfino,Yourkit,Perf4J,JProbe,以及对Java微基准测试的简单介绍, ...

  9. Hadoop 基准测试与example

    #pi值示例 hadoop jar /app/cdh23502/share/hadoop/mapreduce2/hadoop-mapreduce-examples--cdh5. #生成数据 第一个参数 ...

随机推荐

  1. selenium + firefox驱动版本对应。

    1)selenium 2.51.0====firefox 46 selenium 3.11.0 ====firefox 56 后来发现最新的火狐浏览器好多插件都不能用了.所以果断回到46.对应的2.5 ...

  2. GeoServer服务器环境的搭建

    .java 的安装  下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html 我下载的java 1.8版本 1. ...

  3. bzoj 5068: 友好的生物

    大意: n个生物, 每个生物有k种属性, 友好度通过下式计算. , C为给定非负数组, 求友好度最大值. k比较小, 求的是最大值并且$C_i$非负, 所以可以暴力枚举正负情况去绝对值号. #incl ...

  4. day34 GIL锁 线程队列 线程池

    一.Gil锁(Global Interpreter Lock) python全局解释器锁,有了这个锁的存在,python解释器在同一时间内只能让一个进程中的一个线程去执行,这样python的多线程就无 ...

  5. PI上导入RFC

    ERP中创建函数:ZERP_GETSPAREPART 传入参数:SOLD_TO_ID SHIP_TO_ID 表:INTABLE OUTABLE 登陆PI, 后面正常做data type DT_PART ...

  6. 2015-10-19 sql1

        SQL SERVER(一) 一.设置登陆验证 1.右键点击数据库->属性->安全性设置密码登陆 2.数据库下找到安全性->登录名->sa,右键点击sa->属性(修 ...

  7. VMware vSphere Client(Vcenter)上传ISO镜像

    .登录Vcenter后选择"数据存储与数据存储集群" .选择存储的路径,右键-选择“浏览数据存储” .点击上传图标,并上传指定的ISO文件

  8. 在python程序中的进程操作

    multiprocess模块 multiprocess不是一个模块而是python中一个操作.管理进程的包. 之所以叫multi是取自multiple的多功能的意思,在这个包中几乎包含了和进程有关的所 ...

  9. Convert BST to Greater Tree

    Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original B ...

  10. Angular2 NgModule 模块详解

    原文  https://segmentfault.com/a/1190000007187393 我们今天要学习的是Angular2的模块系统,一般情况下我们使用一个根模块去启动我们的应用,然后使用许多 ...