Skip to content
Merged
143 changes: 143 additions & 0 deletions config/sqlserver/sample_tpch_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<?xml version="1.0"?>
<parameters>

<!-- Connection details -->
<type>SQLSERVER</type>
<driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver>
<url>jdbc:sqlserver://localhost:1433;encrypt=false;</url>
<username>benchuser01</username>
<password>P@ssw0rd</password>
<isolation>TRANSACTION_SERIALIZABLE</isolation>
<batchsize>128</batchsize>

<!-- Location for the files generated by tpch dbgen -->
<datadir>data/tpch-sf0.01</datadir>

<!-- Format of the files that contain the tpch data -->
<!-- Values: csv or tbl-->
<fileFormat>tbl</fileFormat>

<!-- This setting doesn't do anything here -->
<scalefactor>0.1</scalefactor>

<!-- The workload -->
<terminals>1</terminals>
<works>
<work>
<serial>true</serial>
<rate>unlimited</rate>
<weights>1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1</weights>
</work>
<work>
<serial>true</serial>
<rate>unlimited</rate>
<weights>0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1</weights>
</work>
<work>
<serial>true</serial>
<rate>unlimited</rate>
<weights>1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0</weights>
</work>
</works>

<transactiontypes>
<groupings>
<grouping>
<name>odd</name>
<weights>1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0</weights>
</grouping>
<grouping>
<name>even</name>
<weights>0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1</weights>
</grouping>
</groupings>
<transactiontype>
<name>Q1</name>
<id>1</id>
</transactiontype>
<transactiontype>
<name>Q2</name>
<id>2</id>
</transactiontype>
<transactiontype>
<name>Q3</name>
<id>3</id>
</transactiontype>
<transactiontype>
<name>Q4</name>
<id>4</id>
</transactiontype>
<transactiontype>
<name>Q5</name>
<id>5</id>
</transactiontype>
<transactiontype>
<name>Q6</name>
<id>6</id>
</transactiontype>
<transactiontype>
<name>Q7</name>
<id>7</id>
</transactiontype>
<transactiontype>
<name>Q8</name>
<id>8</id>
</transactiontype>
<transactiontype>
<name>Q9</name>
<id>9</id>
</transactiontype>
<transactiontype>
<name>Q10</name>
<id>10</id>
</transactiontype>
<transactiontype>
<name>Q11</name>
<id>11</id>
</transactiontype>
<transactiontype>
<name>Q12</name>
<id>12</id>
</transactiontype>
<transactiontype>
<name>Q13</name>
<id>13</id>
</transactiontype>
<transactiontype>
<name>Q14</name>
<id>14</id>
</transactiontype>
<transactiontype>
<name>Q15</name>
<id>15</id>
</transactiontype>
<transactiontype>
<name>Q16</name>
<id>16</id>
</transactiontype>
<transactiontype>
<name>Q17</name>
<id>17</id>
</transactiontype>
<transactiontype>
<name>Q18</name>
<id>18</id>
</transactiontype>
<transactiontype>
<name>Q19</name>
<id>19</id>
</transactiontype>
<transactiontype>
<name>Q20</name>
<id>20</id>
</transactiontype>
<transactiontype>
<name>Q21</name>
<id>21</id>
</transactiontype>
<transactiontype>
<name>Q22</name>
<id>22</id>
</transactiontype>
</transactiontypes>
</parameters>
13 changes: 13 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,19 @@
</dependency>
</dependencies>
</profile>
<profile>
<id>sqlserver</id>
<properties>
<classifier>sqlserver</classifier>
</properties>
<dependencies>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>10.2.0.jre17</version>
</dependency>
</dependencies>
</profile>
</profiles>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/oltpbenchmark/catalog/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void addIndex(Index index) {

public Index getIndex(String indexName) {
for (Index catalog_idx : this.indexes) {
if (catalog_idx.getName().equalsIgnoreCase(indexName)) {
if (indexName.equalsIgnoreCase(catalog_idx.getName())) {
return (catalog_idx);
}
}
Expand Down
132 changes: 132 additions & 0 deletions src/main/resources/benchmarks/tpch/ddl-sqlserver.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
DROP TABLE IF EXISTS lineitem;
DROP TABLE IF EXISTS orders;
DROP TABLE IF EXISTS customer;
DROP TABLE IF EXISTS partsupp;
DROP TABLE IF EXISTS part;
DROP TABLE IF EXISTS supplier;
DROP TABLE IF EXISTS nation;
DROP TABLE IF EXISTS region;

CREATE TABLE region (
r_regionkey integer NOT NULL,
r_name char(25) NOT NULL,
r_comment varchar(152),
PRIMARY KEY (r_regionkey)
);
CREATE UNIQUE INDEX r_rk ON region (r_regionkey ASC);

CREATE TABLE nation (
n_nationkey integer NOT NULL,
n_name char(25) NOT NULL,
n_regionkey integer NOT NULL,
n_comment varchar(152),
PRIMARY KEY (n_nationkey),
FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)
);
CREATE UNIQUE INDEX n_nk ON nation (n_nationkey ASC);
CREATE INDEX n_rk ON nation (n_regionkey ASC);

CREATE TABLE part (
p_partkey integer NOT NULL,
p_name varchar(55) NOT NULL,
p_mfgr char(25) NOT NULL,
p_brand char(10) NOT NULL,
p_type varchar(25) NOT NULL,
p_size integer NOT NULL,
p_container char(10) NOT NULL,
p_retailprice decimal(15, 2) NOT NULL,
p_comment varchar(23) NOT NULL,
PRIMARY KEY (p_partkey)
);
CREATE UNIQUE INDEX p_pk ON part (p_partkey ASC);

CREATE TABLE supplier (
s_suppkey integer NOT NULL,
s_name char(25) NOT NULL,
s_address varchar(40) NOT NULL,
s_nationkey integer NOT NULL,
s_phone char(15) NOT NULL,
s_acctbal decimal(15, 2) NOT NULL,
s_comment varchar(101) NOT NULL,
PRIMARY KEY (s_suppkey),
FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)
);
CREATE UNIQUE INDEX s_sk ON supplier (s_suppkey ASC);
CREATE INDEX s_nk ON supplier (s_nationkey ASC);

CREATE TABLE partsupp (
ps_partkey integer NOT NULL,
ps_suppkey integer NOT NULL,
ps_availqty integer NOT NULL,
ps_supplycost decimal(15, 2) NOT NULL,
ps_comment varchar(199) NOT NULL,
PRIMARY KEY (ps_partkey, ps_suppkey),
FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),
FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)
);
CREATE INDEX ps_pk ON partsupp (ps_partkey ASC);
CREATE INDEX ps_sk ON partsupp (ps_suppkey ASC);
CREATE UNIQUE INDEX ps_pk_sk ON partsupp (ps_partkey ASC, ps_suppkey ASC);
CREATE UNIQUE INDEX ps_sk_pk ON partsupp (ps_suppkey ASC, ps_partkey ASC);

CREATE TABLE customer (
c_custkey integer NOT NULL,
c_name varchar(25) NOT NULL,
c_address varchar(40) NOT NULL,
c_nationkey integer NOT NULL,
c_phone char(15) NOT NULL,
c_acctbal decimal(15, 2) NOT NULL,
c_mktsegment char(10) NOT NULL,
c_comment varchar(117) NOT NULL,
PRIMARY KEY (c_custkey),
FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)
);
CREATE UNIQUE INDEX c_ck ON customer (c_custkey ASC);
CREATE INDEX c_nk ON customer (c_nationkey ASC);

CREATE TABLE orders (
o_orderkey integer NOT NULL,
o_custkey integer NOT NULL,
o_orderstatus char(1) NOT NULL,
o_totalprice decimal(15, 2) NOT NULL,
o_orderdate date NOT NULL,
o_orderpriority char(15) NOT NULL,
o_clerk char(15) NOT NULL,
o_shippriority integer NOT NULL,
o_comment varchar(79) NOT NULL,
PRIMARY KEY (o_orderkey),
FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)
);
CREATE UNIQUE INDEX o_ok ON orders (o_orderkey ASC);
CREATE INDEX o_ck ON orders (o_custkey ASC);
CREATE INDEX o_od ON orders (o_orderdate ASC);

CREATE TABLE lineitem (
l_orderkey integer NOT NULL,
l_partkey integer NOT NULL,
l_suppkey integer NOT NULL,
l_linenumber integer NOT NULL,
l_quantity decimal(15, 2) NOT NULL,
l_extendedprice decimal(15, 2) NOT NULL,
l_discount decimal(15, 2) NOT NULL,
l_tax decimal(15, 2) NOT NULL,
l_returnflag char(1) NOT NULL,
l_linestatus char(1) NOT NULL,
l_shipdate date NOT NULL,
l_commitdate date NOT NULL,
l_receiptdate date NOT NULL,
l_shipinstruct char(25) NOT NULL,
l_shipmode char(10) NOT NULL,
l_comment varchar(44) NOT NULL,
PRIMARY KEY (l_orderkey, l_linenumber),
FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),
FOREIGN KEY (l_partkey, l_suppkey) REFERENCES partsupp (ps_partkey, ps_suppkey)
);
CREATE INDEX l_ok ON lineitem (l_orderkey ASC);
CREATE INDEX l_pk ON lineitem (l_partkey ASC);
CREATE INDEX l_sk ON lineitem (l_suppkey ASC);
CREATE INDEX l_sd ON lineitem (l_shipdate ASC);
CREATE INDEX l_cd ON lineitem (l_commitdate ASC);
CREATE INDEX l_rd ON lineitem (l_receiptdate ASC);
CREATE INDEX l_pk_sk ON lineitem (l_partkey ASC, l_suppkey ASC);
CREATE INDEX l_sk_pk ON lineitem (l_suppkey ASC, l_partkey ASC);
Loading