Code Monkey home page Code Monkey logo

tpc-h-dataset-generator-ms-sql-server's Introduction

TPC-H Dataset Generator

TPC-H Data and Query Generator for Microsoft SQL Server on Linux. This repo was modified from version 2.18 of TPC-H benchmark. The modification is created with the purpose of introducing better support for loading this benchmark in Microsoft SQL on Linux.

Getting started

Loading the database from TPC-H

  • Move to main directory for generation related operations:
cd dbgen
  • Compile the necessary object and executable files:
make
  • Generate the data. Choose the scale factor you want for the data. TPC-H runs are only compliant when run against SF's of 1, 10, 100, 300, 1000, 3000, 10000, 30000, 100000. If you want more option, try to take a look at dbgen/README:
./dbgen -s <scale>

After that, the bulk file will be created under the extension of .tbl.

  • Create the schema and load the data into the database. Remember to modify the path of the .tbl files at the end of this sql script before running it. Supply the username and password of your database into <username> and <password>:
sqlcmd -S <server_ip> -U <username> -P <password> -i schema/tpch.sql
  • Create primary keys and foreign keys. If you ran into errors such as not being able create primary key on nullable column, you could try looking inside the script and running the lines involving altering the columns for primary key to NOT NULL:
sqlcmd -S <server_ip> -U <username> -P <password> -i schema/tpch_fk.sql
  • In case you need to start or stop the MSSQL Service, use bash start_mssql.sh and bash stop_mssql.sh

Generating the queries

cd ..
python3 gen_queries.py -u <db admin> -p <password> --num_queries <number of queries per template> --test_split <the percentage of templates to use in test set>

The result is stored in dbgen/generated_queries

Note that I am using these templates to generate showplan, so if you do not want to use showplan, you can remove

set showplan_all on;
go

in each template sql file in dbgen/queries/

tpc-h-dataset-generator-ms-sql-server's People

Contributors

nghiahhnguyen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.