EagleBear2002 的博客

这里必须根绝一切犹豫,这里任何怯懦都无济于事

TPC-C benchmark

TPC-C(Transaction Processing Performance Council - TPC-C)是一个基准测试(benchmarking)标准,用于评估和比较数据库管理系统(DBMS)在事务处理场景下的性能。

官方文档:https://www.tpc.org/TPC_Documents_Current_Versions/pdf/tpc-c_v5.11.0.pdf

数据模式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// 仓库类
class Warehouse {
int warehouseId;
String warehouseName;
String warehouseAddress;
String warehouseCity;
String warehouseState;
String warehouseZip;
double warehouseTax;
double warehouseYtd;
}

// 顾客类
class Customer {
int customerId;
int customerWarehouseId;
int customerDistrictId;
String customerFirstName;
String customerLastName;
String customerAddress;
String customerCity;
String customerState;
String customerZip;
String customerPhone;
Date customerSince;
String customerCredit;
double customerCreditLimit;
double customerDiscount;
double customerBalance;
double customerYtdPayment;
int customerPaymentCount;
int customerDeliveryCount;
}

// 订单类
class Order {
int orderId;
int orderWarehouseId;
int orderDistrictId;
int orderCustomerId;
int orderCarrierId;
int orderLineCount;
boolean orderIsNew;
boolean orderIsFilled;
Date orderEntryDate;
Date orderCarrierDeliveryDate;
int[] orderLineItems; // 订单项
}

// 订单项类
class OrderLine {
int orderLineId;
int orderLineWarehouseId;
int orderLineDistrictId;
int orderLineOrderId;
int orderLineItemId;
int orderLineSupplyWarehouseId;
double orderLineQuantity;
double orderLineAmount;
Date orderLineDeliveryDate;
int orderLineIsNew;
}

// 商品类
class Item {
int itemId;
int itemWarehouseId;
double itemPrice;
String itemDescription;
Date itemReleaseDate;
String itemImageUrl;
}

// 供应商类
class Supplier {
int supplierId;
String supplierName;
String supplierAddress;
String supplierCity;
String supplierState;
String supplierZip;
String supplierPhone;
double supplierBalance;
}

// 库存类
class Stock {
int stockItemId;
int stockWarehouseId;
int stockDistrictId;
int stockQuantity;
String stockDist01;
String stockDist02;
String stockDist03;
String stockDist04;
String stockDist05;
String stockDist06;
String stockDist07;
String stockDist08;
String stockDist09;
String stockDist10;
double stockYtd;
int stockOrderCount;
int stockRemoteCount;
String stockData;
}

事务模式

1
2
3
public void createNewOrder(int warehouseID, int districtID, int customerID,
int orderLineCnt, int allLocal, int[] itemIDs,
int[] supplierWarehouseIDs, int[] orderQuantities)
1
public void delivery(int numDistricts, int warehouseID, int carrierID)
1
2
3
//all but warehouseID are random!!!
public String orderStatus(int warehouseID, int districtID, int customerID,
String customerName, boolean customerIDSearch)
1
2
public void payment(int warehouseID, int districtID, int customerID,
String customerName, boolean customerIDSearch, float paymentAmount)
1
public Integer stockLevel( int warehouseID, int districtID, int threshold)