下载BenchmarkSQL并使用BenchmarkSQL查看OceanBase 的执行计划

下载BenchmarkSQL并使用BenchmarkSQL查看OceanBase 的执行计划

  • 一、什么是BenchmarkSQL
  • 二、下载BenchmarkSQL
  • 三、使用BenchmarkSQL查看OceanBase 的执行计划

一、什么是BenchmarkSQL

在这里插入图片描述

BenchmarkSQL是一个开源的数据库基准测试工具,可以用来评估数据库系统的性能,支持多种常见的数据库系统,包括EnterpriseDB、PostgreSQL、Oracle、Sybase、SQL Server、MySQL、HsqlDB、Derby/JavaDB和FireBird等。它的官网是:https://sourceforge.net/projects/benchmarksql/。

在国内的生产实践中,外键约束已经较少使用,但BenchmarkSQL的实现仍然广泛采用了外键约束,以符合TPC-C的要求。它的Order逻辑由4个SELECT、3个INSERT、2个UPDATE组成,和在微服务中不用匿名块和存储过程实现的逻辑高度匹配。

二、下载BenchmarkSQL

  1. 点击此链接跳转官方网站下载:https://sourceforge.net/projects/benchmarksql/
    在这里插入图片描述

  2. 上传至linux
    在这里插入图片描述

    这里使用的传输工具为:SecureCRT9
    安装步骤见此文:SecureCRT9汉化版安装
    也可关注文末公众号:数据探索者007 回复01获取

  3. 减压文件

    [oceanbase@localhost ~]$ ls
    benchmarksql-5.0.zip  myoceanbase  mysql_test
    [oceanbase@localhost ~]$ unzip benchmarksql-5.0.zip 
    Archive:  benchmarksql-5.0.zip
    6036b15716cf8c142465ac8092d53a777d609684
       creating: benchmarksql-5.0/
     extracting: benchmarksql-5.0/.gitignore  
      inflating: benchmarksql-5.0/HOW-TO-RUN.txt  
      inflating: benchmarksql-5.0/README.md  
      inflating: benchmarksql-5.0/build.xml  
       creating: benchmarksql-5.0/doc/
       creating: benchmarksql-5.0/doc/src/
      inflating: benchmarksql-5.0/doc/src/TimedDriver.odt  
       creating: benchmarksql-5.0/lib/
     extracting: benchmarksql-5.0/lib/.gitignore  
      inflating: benchmarksql-5.0/lib/apache-log4j-extras-1.1.jar  
       creating: benchmarksql-5.0/lib/firebird/
      inflating: benchmarksql-5.0/lib/firebird/connector-api-1.5.jar  
      inflating: benchmarksql-5.0/lib/firebird/jaybird-2.2.9.jar  
      inflating: benchmarksql-5.0/lib/log4j-1.2.17.jar  
       creating: benchmarksql-5.0/lib/oracle/
     extracting: benchmarksql-5.0/lib/oracle/.gitignore  
      inflating: benchmarksql-5.0/lib/oracle/README.txt  
       creating: benchmarksql-5.0/lib/postgres/
      inflating: benchmarksql-5.0/lib/postgres/postgresql-9.3-1102.jdbc41.jar  
       creating: benchmarksql-5.0/run/
     extracting: benchmarksql-5.0/run/.gitignore  
      inflating: benchmarksql-5.0/run/funcs.sh  
      inflating: benchmarksql-5.0/run/generateGraphs.sh  
      inflating: benchmarksql-5.0/run/generateReport.sh  
      inflating: benchmarksql-5.0/run/log4j.properties  
       creating: benchmarksql-5.0/run/misc/
      inflating: benchmarksql-5.0/run/misc/blk_device_iops.R  
      inflating: benchmarksql-5.0/run/misc/blk_device_kbps.R  
      inflating: benchmarksql-5.0/run/misc/cpu_utilization.R  
      inflating: benchmarksql-5.0/run/misc/dirty_buffers.R  
      inflating: benchmarksql-5.0/run/misc/latency.R  
      inflating: benchmarksql-5.0/run/misc/net_device_iops.R  
      inflating: benchmarksql-5.0/run/misc/net_device_kbps.R  
      inflating: benchmarksql-5.0/run/misc/os_collector_linux.py  
      inflating: benchmarksql-5.0/run/misc/tpm_nopm.R  
      inflating: benchmarksql-5.0/run/props.fb  
      inflating: benchmarksql-5.0/run/props.ora  
      inflating: benchmarksql-5.0/run/props.pg  
      inflating: benchmarksql-5.0/run/runBenchmark.sh  
      inflating: benchmarksql-5.0/run/runDatabaseBuild.sh  
      inflating: benchmarksql-5.0/run/runDatabaseDestroy.sh  
      inflating: benchmarksql-5.0/run/runLoader.sh  
      inflating: benchmarksql-5.0/run/runSQL.sh  
       creating: benchmarksql-5.0/run/sql.common/
      inflating: benchmarksql-5.0/run/sql.common/buildFinish.sql  
      inflating: benchmarksql-5.0/run/sql.common/foreignKeys.sql  
      inflating: benchmarksql-5.0/run/sql.common/indexCreates.sql  
      inflating: benchmarksql-5.0/run/sql.common/indexDrops.sql  
      inflating: benchmarksql-5.0/run/sql.common/tableCreates.sql  
      inflating: benchmarksql-5.0/run/sql.common/tableDrops.sql  
      inflating: benchmarksql-5.0/run/sql.common/tableTruncates.sql  
       creating: benchmarksql-5.0/run/sql.firebird/
      inflating: benchmarksql-5.0/run/sql.firebird/extraHistID.sql  
       creating: benchmarksql-5.0/run/sql.oracle/
      inflating: benchmarksql-5.0/run/sql.oracle/extraHistID.sql  
       creating: benchmarksql-5.0/run/sql.postgres/
      inflating: benchmarksql-5.0/run/sql.postgres/buildFinish.sql  
      inflating: benchmarksql-5.0/run/sql.postgres/extraHistID.sql  
      inflating: benchmarksql-5.0/run/sql.postgres/tableCopies.sql  
       creating: benchmarksql-5.0/src/
       creating: benchmarksql-5.0/src/LoadData/
      inflating: benchmarksql-5.0/src/LoadData/LoadData.java  
      inflating: benchmarksql-5.0/src/LoadData/LoadDataWorker.java  
       creating: benchmarksql-5.0/src/OSCollector/
      inflating: benchmarksql-5.0/src/OSCollector/OSCollector.java  
       creating: benchmarksql-5.0/src/client/
      inflating: benchmarksql-5.0/src/client/jTPCC.java  
      inflating: benchmarksql-5.0/src/client/jTPCCConfig.java  
      inflating: benchmarksql-5.0/src/client/jTPCCConnection.java  
      inflating: benchmarksql-5.0/src/client/jTPCCRandom.java  
      inflating: benchmarksql-5.0/src/client/jTPCCTData.java  
      inflating: benchmarksql-5.0/src/client/jTPCCTerminal.java  
      inflating: benchmarksql-5.0/src/client/jTPCCUtil.java  
       creating: benchmarksql-5.0/src/jdbc/
      inflating: benchmarksql-5.0/src/jdbc/ExecJDBC.java  
    [oceanbase@localhost ~]$ ls
    benchmarksql-5.0  benchmarksql-5.0.zip  myoceanbase  mysql_test
    [oceanbase@localhost ~]$ 
    [oceanbase@localhost ~]$ tree benchmarksql-5.0
    benchmarksql-5.0
    ├── build.xml
    ├── doc
    │   └── src
    │       └── TimedDriver.odt
    ├── HOW-TO-RUN.txt
    ├── lib
    │   ├── apache-log4j-extras-1.1.jar
    │   ├── firebird
    │   │   ├── connector-api-1.5.jar
    │   │   └── jaybird-2.2.9.jar
    │   ├── log4j-1.2.17.jar
    │   ├── oracle
    │   │   └── README.txt
    │   └── postgres
    │       └── postgresql-9.3-1102.jdbc41.jar
    ├── README.md
    ├── run
    │   ├── funcs.sh
    │   ├── generateGraphs.sh
    │   ├── generateReport.sh
    │   ├── log4j.properties
    │   ├── misc
    │   │   ├── blk_device_iops.R
    │   │   ├── blk_device_kbps.R
    │   │   ├── cpu_utilization.R
    │   │   ├── dirty_buffers.R
    │   │   ├── latency.R
    │   │   ├── net_device_iops.R
    │   │   ├── net_device_kbps.R
    │   │   ├── os_collector_linux.py
    │   │   └── tpm_nopm.R
    │   ├── props.fb
    │   ├── props.ora
    │   ├── props.pg
    │   ├── runBenchmark.sh
    │   ├── runDatabaseBuild.sh
    │   ├── runDatabaseDestroy.sh
    │   ├── runLoader.sh
    │   ├── runSQL.sh
    │   ├── sql.common
    │   │   ├── buildFinish.sql
    │   │   ├── foreignKeys.sql
    │   │   ├── indexCreates.sql
    │   │   ├── indexDrops.sql
    │   │   ├── tableCreates.sql
    │   │   ├── tableDrops.sql
    │   │   └── tableTruncates.sql
    │   ├── sql.firebird
    │   │   └── extraHistID.sql
    │   ├── sql.oracle
    │   │   └── extraHistID.sql
    │   └── sql.postgres
    │       ├── buildFinish.sql
    │       ├── extraHistID.sql
    │       └── tableCopies.sql
    └── src
        ├── client
        │   ├── jTPCCConfig.java
        │   ├── jTPCCConnection.java
        │   ├── jTPCC.java
        │   ├── jTPCCRandom.java
        │   ├── jTPCCTData.java
        │   ├── jTPCCTerminal.java
        │   └── jTPCCUtil.java
        ├── jdbc
        │   └── ExecJDBC.java
        ├── LoadData
        │   ├── LoadData.java
        │   └── LoadDataWorker.java
        └── OSCollector
            └── OSCollector.java
    
    17 directories, 54 files
    [oceanbase@localhost ~]$ 
    
  4. 配置BenchmarkSQL
    使用如下命令进入props.ora 文件进行配置

    [oceanbase@localhost ~]$ vi benchmarksql-5.0/run/props.ora 
    

    具体配置如下:

    db=oracle
    driver=com.alipay.oceanbase.obproxy.mysql.jdbc.Driver
    conn=jdbc:oceanbase://192.168.66.110:2881/benchmark_sql?useUnicode=true&characterEncoding=utf-8
    user=user01@t1
    password=rootroot
    
    warehouses=1
    loadWorkers=4
    
    terminals=1
    //To run specified transactions per terminal- runMins must equal zero
    runTxnsPerTerminal=10
    //To run for specified minutes- runTxnsPerTerminal must equal zero
    runMins=0
    //Number of total transactions per minute
    limitTxnsPerMin=300
    
    //Set to true to run in 4.x compatible mode. Set to false to use the
    //entire configured database evenly.
    terminalWarehouseFixed=true
    
    //The following five values must add up to 100
    newOrderWeight=45
    paymentWeight=43
    orderStatusWeight=4
    deliveryWeight=4
    stockLevelWeight=4
    
    // Directory name to create for collecting detailed result data.
    // Comment this out to suppress.
    resultDirectory=my_result_%tY-%tm-%td_%tH%tM%tS
    osCollectorScript=./misc/os_collector_linux.py
    osCollectorInterval=1
    //osCollectorSSHAddr=user@dbhost
    osCollectorDevices=net_eth0 blk_sda
    ~                                                                        
    ~                                                                        
    ~                                                                        
    ~                                                                        
    ~                                            
    

    在这里插入图片描述

三、使用BenchmarkSQL查看OceanBase 的执行计划

  1. 下载ant
    在这里插入图片描述
    设置ant环境

    [root@localhost ~]# vi ~/.bash_profile 
    [root@localhost ~]# source /etc/profile
    [root@localhost ~]# ant -version
    Apache Ant(TM) version 1.9.4 compiled on November 5 2018
    

    在这里插入图片描述
    在对应目录下编译BenchmarkSQL

    [oceanbase@localhost ~]$ cd benchmarksql-5.0
    [oceanbase@localhost benchmarksql-5.0]$ ant
    Buildfile: /home/oceanbase/benchmarksql-5.0/build.xml
    
    init:
        [mkdir] Created dir: /home/oceanbase/benchmarksql-5.0/build
    
    compile:
        [javac] Compiling 11 source files to /home/oceanbase/benchmarksql-5.0/build
    
    dist:
        [mkdir] Created dir: /home/oceanbase/benchmarksql-5.0/dist
          [jar] Building jar: /home/oceanbase/benchmarksql-5.0/dist/BenchmarkSQL-5.0.jar
    
    BUILD SUCCESSFUL
    Total time: 2 seconds
    
  2. 准备Oceanbase驱动文件
    下载 JDBC 驱动,BenchmarkSQL 是通过 JDBC 连接各个数据库的。此次 OceanBase 的测试租户是 MySQL 类型,所以需要把相关 Jar 包一并放入其中

    Oceanbase驱动文件
    在这里插入图片描述
    下载好后放在benchmarksql-5.0/lib/

  3. 创建建表sql文件
    benchmarksql-5.0/run/sql.common/目录下,使用如下语句:

    vi benchmarksql-5.0/run/sql.common/createTables.sql
    

    createTables.sql文件内容如下:

    CREATE TABLE students (
        id INT PRIMARY KEY,
        name VARCHAR(50),
        age INT,
        gender ENUM('Male', 'Female')
    );
    CREATE TABLE courses (
        id INT PRIMARY KEY,
        name VARCHAR(50)
    );
    CREATE TABLE student_courses (
        student_id INT,
        course_id INT,
        grade INT,
        FOREIGN KEY (student_id) REFERENCES students(id),
        FOREIGN KEY (course_id) REFERENCES courses(id)
    );
    
  4. 修改runSQL.sh文件

    [oceanbase@localhost ~]$ cd benchmarksql-5.0/run/
    [oceanbase@localhost run]$ pwd
    /home/oceanbase/benchmarksql-5.0/run
    [oceanbase@localhost run]$ cd
    [oceanbase@localhost ~]$ vi benchmarksql-5.0/run/runSQL.sh 
    [oceanbase@localhost ~]$ 
    
    source /home/oceanbase/benchmarksql-5.0/run/fu1ncs.sh $
    

    在这里插入图片描述

  5. 执行测试:

    [oceanbase@localhost run]$ sh runSQL.sh props.ora sql.common/createTables.sql
    # ------------------------------------------------------------
    # Loading SQL file sql.common/createTables.sql
    # ------------------------------------------------------------
    CREATE TABLE students (
    id INT PRIMARY KEY,
    name VARCHAR(50),
    age INT,
    gender ENUM('Male', 'Female')
    );
    CREATE TABLE courses (
    id INT PRIMARY KEY,
    name VARCHAR(50)
    );
    CREATE TABLE student_courses (
    student_id INT,
    course_id INT,
    grade INT,
    FOREIGN KEY (student_id) REFERENCES students(id),
    FOREIGN KEY (course_id) REFERENCES courses(id)
    );
    [oceanbase@localhost run]$ 
    [oceanbase@localhost run]$
    
    ./runBenchmark.sh props.ora
    

    在这里插入图片描述


更多精彩文章可扫码关注公主号查看:
在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/451851.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

基于YOLOv8/YOLOv7/YOLOv6/YOLOv5的草莓成熟度检测系统详解(深度学习模型+UI界面+Python代码+训练数据集)

摘要:本研究介绍了一个使用深度学习技术对草莓成熟度进行检测的系统,它采用了最新的YOLOv8算法,以及YOLOv7、YOLOv6、YOLOv5等前版本的算法,并对它们进行了性能对比。该系统能够在不同媒介上——如图像、视频文件、实时视频流和批…

28 批量归一化【李沐动手学深度学习v2课程笔记】(备注:这一节讲的很迷惑,很乱)

目录 1.批量归一化 1.1训练神经网络时出现的挑战 1.2核心思想 1.3原理 2.批量规范化层 2.1 全连接层 2.2 卷积层 2.3 总结 3. 代码实现 4. 使用批量规范化层的LeNet 5. 简明实现 1.批量归一化 现在主流的卷积神经网络几乎都使用了批量归一化 批量归一化是一种流行且…

Scrapy 爬虫框架

网络爬虫框架scrapy (配置型爬虫) 什么是爬虫框架? 爬虫框架是实现爬虫功能的一个软件结构和功能组件集合爬虫框架是个半成品,帮助用户实现专业网络爬虫 scrapy框架结构("52"结构) spider: 解析downloader返回的响…

【读论文】【精读】3D Gaussian Splatting for Real-Time Radiance Field Rendering

文章目录 1. What:2. Why:3. How:3.1 Real-time rendering3.2 Adaptive Control of Gaussians3.3 Differentiable 3D Gaussian splatting 4. Self-thoughts 1. What: What kind of thing is this article going to do (from the a…

传输层协议介绍(tcp,udp),可靠性和不可靠性

目录 传输层协议 介绍 tcp协议 介绍 面向连接 可靠性 面向字节流 udp协议 介绍 无连接 不可靠 面向数据报 可靠和不可靠 可靠 不可靠 传输层协议 介绍 传输层是计算机网络体系结构中的第四层,它负责在网络中的不同主机之间提供端到端的数据传输 传输…

ARMv8架构特殊寄存器介绍-1

1,ELR寄存器(Exception Link Register ) The Exception Link Register holds the exception return address。 异常链接寄存器保存异常返回地址。最常用也很重要。 2,SPSR(Saved Process Status Register)…

PDF 文件与其他文档格式相比有哪些优势?

PDF文件与其他文档格式相比,具有许多明显的优势。首先,PDF是一种跨平台的文档格式,这意味着无论在哪种操作系统或设备上,用户都可以打开和查看PDF文件,而无需担心格式不兼容的问题。这种跨平台性使得PDF文件在办公、学…

Centos7安装postgresql14步骤

1、进入网址 https://www.postgresql.org/download/ 2、按步骤执行 # Install the repository RPM: sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm# Install PostgreSQL: sudo yum install -y…

基于springboot+vue的线上教育系统(源码+论文)

目录 前言 一、功能设计 二、功能实现 三、库表设计 四、论文 前言 现在大家的生活方式正在被计算机的发展慢慢改变着,学习方式也逐渐由书本走向荧幕,我认为这并不是不能避免的,但说实话,现在的生活方式与以往相比有太大的改变,人们的娱乐方式不仅仅…

PHP立体安全攻击向量:保护应用程序的关键挑战

PHP立体安全攻击向量:保护应用程序的关键挑战 PHP作为一种广泛使用的服务器端脚本语言,拥有庞大的用户群体和丰富的生态系统。然而,随着互联网的发展,网络安全问题也变得愈发严重。本文将深入探讨PHP的立体安全攻击向量&#xff0…

FPGA高端项目:FPGA基于GS2971+GS2972架构的SDI视频收发+图像缩放,提供3套工程源码和技术支持

目录 1、前言免责声明 2、相关方案推荐本博已有的 SDI 编解码方案本方案的SDI接收发送本方案的SDI接收纯verilog图像缩放纯verilog多路视频拼接应用本方案的SDI接收HLS图像缩放HLS多路视频拼接应用本方案的SDI接收OSD动态字符叠加输出应用本方案的SDI接收HLS多路视频融合叠加应…

jupyter 修改文件保存位置 步骤

一、找到配置文件位置 打开Anaconda Prompt,输入: jupyter notebook --generate-config 根据得到的路径,以记事本方式打开配置文件 二、修改路径 在文件中输入: c.NotebookApp.notebook_dir E:\\deepLearning\\Jupyter_files…

SQL-2

• What have we achieved so far using SELECT ? — Retrieve data from all the rows and columns (whole table) — Retrieve data from all the rows and select columns — Retrieve data from select rows and columns • Sometimes we want to re-format the output fr…

​扩散模型(Diffusion Model)详解:直观理解、数学原理、PyTorch 实现​

在过去的大半年里,以Stable Diffusion为代表的AI绘画是世界上最为火热的AI方向之一。或许大家会有疑问,Stable Diffusion里的这个"Diffusion"是什么意思?其实,扩散模型(Diffusion Model)正是Stable Diffusion中负责生成…

【Preprocessing数据预处理】之Scaler

在机器学习中,特征缩放是训练模型前数据预处理阶段的一个关键步骤。不同的缩放器被用来规范化或标准化特征。这里简要概述了您提到的几种缩放器: StandardScaler StandardScaler 通过去除均值并缩放至单位方差来标准化特征。这种缩放器假设特征分布是正…

让生活更加精致的APP?

晚上好,今天博主来介绍几款帮助你条理生活的APP,让你的生活更加精致,充满仪式感。 一.格志日记 一款以“格子”的方式记录日记的APP,非常简单明了,用户可以依据自己的喜好,来自由定义或者删除格…

Qt/C++音视频开发69-保存监控pcm音频数据到mp4文件/监控录像/录像存储和回放/264/265/aac/pcm等

一、前言 用ffmpeg做音视频保存到mp4文件,都会遇到一个问题,尤其是在视频监控行业,就是监控摄像头设置的音频是PCM/G711A/G711U,解码后对应的格式是pcm_s16be/pcm_alaw/pcm_mulaw,将这个原始的音频流保存到mp4文件是会…

关于电脑无法开启5G频段热点的解决方案

tips:本文是本着解决校园网开热点后限速的问题的目的,具体情况具体对待。 1.找到设备管理器 右键该选项 2.在新弹出窗口选择首选频带 3.选择首选5GHz频带 确定之后重新连接wifi,重新开启热点,大功告成。 后记:在使用2.4ghz开热点…

细粒度IP定位参文2(Corr-SLG):A street-level IP geolocation method (2021年)

[2]S. Ding, F. Zhao, and X. Luo, “A street-level IP geolocation method based on delay-distance correlation and multilayered common routers,” Secur. Commun. Netw., vol. 2021, no. 1, pp. 1–10, 2021. 智能设备的地理位置可以帮助提供多媒体内容提供商和5G网络中…

基于YOLOv8/YOLOv7/YOLOv6/YOLOv5的行人跌倒检测系统(深度学习+UI界面+完整训练数据集)

摘要:开发行人跌倒检测系统在确保老年人安全方面扮演着至关重要的角色。本篇文章详尽地阐述了如何利用深度学习技术构建一个行人跌倒检测系统,并附上了完整的代码实现。该系统采用了先进的YOLOv8算法,并对YOLOv7、YOLOv6、YOLOv5等先前版本进…
最新文章